What is Guidline For Vertical Spacing in c# When to do it asp.net actions

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,190
Location
Sydney, Australia
Programming Experience
10+
Please provide a FULL and CLEAR explanation of the problem. Don't try to get away with writing as few words as possible. I think I know what you're asking but I'm not 100% sure, so I might get it wrong. Your questions should be completely unambiguous.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,190
Location
Sydney, Australia
Programming Experience
10+
If you're asking whether you should include blank lines between controller actions in your code and, if so, how many, the general advice would be to include a single blank line between two methods or other members. Controller actions are just methods, after all. You might want to include two blank lines between some groups of members to indicate some level of distinction, but I would tend to suggest using regions for that and stick to just one blank line between any two members. I'd suggest never having more than one blank line anywhere in your code. Having more generally makes code harder to read. I see some people posting code snippets with huge chunks of empty space in it and I have to wonder why.
 
Joined
Oct 31, 2021
Messages
9
Programming Experience
Beginner
what I mean is as in Microsoft site we Guilline for c# Naming Convention as to start variable name from camelcase and data member of the class in Pascal case so I am asking for Convention for what convention should we follow for Vertical spacing in c# specially in writing functions or actions in controller
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,190
Location
Sydney, Australia
Programming Experience
10+
I've never seen anything on that from Microsoft themselves but there is this:


which aligns with what I have seen elsewhere, e.g. recommendation from ReSharper.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
4,029
Location
Chesapeake, VA
Programming Experience
10+
From MS:
 
Top Bottom