我想正确缩进文本文件中包含的一些VB.NET代码.有办法做到这一点吗?
例如
从这开始:
Public Shared Function CanReachPage(page As String) As Boolean Try Using client = New WebClient() Using stream = client.OpenRead(page) Return True End Using End Using Catch Return False End Try End Function
完成这个:
Public Shared Function CanReachPage(page As String) As Boolean Try Using client = New WebClient() Using stream = client.OpenRead(page) Return True End Using End Using Catch Return False End Try End Function
到目前为止,我搜索到的所有东西都引导我进入IndentedTextWriter类,但我发现的唯一例子是手动缩进这样的行:.NET Console TextWriter that Understands Indent/Unindent/IndentLevel
额外的功劳:如果可能,我还想添加正确的间距:
例如Dim i As String =“Hello”“GoodBye” – > Dim i As String =“你好”“GoodBye”