What is the proper way to format code?

前端 未结 22 2147
没有蜡笔的小新
没有蜡笔的小新 2021-02-18 18:33

When I write code, I try to group lines of similar code together, then leave a blank line and write another block.

I believe this contributes to the neatness and readabi

22条回答
  •  不思量自难忘°
    2021-02-18 19:03

    I follow Microsoft's Guidelines for C#.

    Edit: The standard for C# is Don't fight the IDE. If you hit CTRL K+D, the IDE will automatically put blank lines in between code sections.

    To follow that up, if you look at C# sample code on MSDN or anywhere else, there's normally a blank line in between each logically placed group. So There will be a blank line after all your member variables, a blank line after each method, etc.

    In response to the comments expressing shock and horror that I use an IDE for C# programming:


    REAL PROGRAMMERS

提交回复
热议问题