关闭。这个问题是opinion-based .它目前不接受答案。
想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题.
7年前关闭。
Improve this question
如果您有一个多行 IF 语句,默认缩进可能有点难以阅读:
If SomeConditionA _
AndAlso SomeConditionB _
AndAlso SomeConditionC Then
DoSomething()
End If
我可以想到几个选项来解决这个问题,例如:
但是我想知道对于这种情况是否有一些完善的甚至官方推荐的编码风格。
最佳答案
好吧其实根据coding conventions , 你应该
Avoid using the explicit line continuation character "_" in favor of implicit line continuation wherever the language allows it.
所以代码实际上应该是这样的:
If SomeconditionA AndAlso
SomeconditionB AndAlso
SomeconditionC Then
DoSomething()
End If
然后声明:
If Pretty listing (reformatting) of code doesn't format continuation lines automatically, manually indent continuation lines one tab stop. However, always left-align items in a list.
所以我会说这是根据建议(缩进一个制表位)
关于vb.net - Visual Basic .NET 中多行 IF 语句缩进的编码风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23537559/