Coding style for indentation of a multi-line IF statement in Visual Basic.NET.

If you have a multi-line IF statement, the default indent can be a little difficult to read:

If SomeConditionA _
    AndAlso SomeConditionB _
    AndAlso SomeConditionC Then
    DoSomething()
End If

I can come up with several solutions to this problem, for example:

  • indent the second and third lines by 8 instead of 4 spaces,
  • Do not step back from the second and third lines,
  • adding an empty line after the third line,
  • ...

But I would like to know if there is some well established or even officially recommended coding style for this case.

+4
source share
1 answer

, , ,

"_" , .

, :

    If SomeconditionA AndAlso
        SomeconditionB AndAlso
        SomeconditionC Then
        DoSomething()
    End If

:

Pretty () , - . .

, , ( )

+1

Source: https://habr.com/ru/post/1539729/


All Articles