Solved

Are various indentation styles typically shunned in C#?

Posted on 2012-03-10
2
247 Views
Last Modified: 2012-03-11
Are various indentation styles outside the Allman style typically shunned in the C# community?

I'm trying to figure out whether to get used to the Allman style in case I ever get a .Net development job.

http://en.wikipedia.org/wiki/Indent_style
0
Comment
Question by:Eindoofus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 37705594
I actually use that style myself, because I find it easiest to read and update.
moreover, I often put a // comment at the closing bracket.

if (condition)
{
 . ..
} // if (condition)

which is especially useful with longer and deeply included conditions .
better would be the use of #region ... #end region, but more to type and maintain ..
0
 
LVL 50

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 37706287
The Allman style is default in VS and in all newer documentation from MS, so I adopted it easily as I came from VB/VBA, thus had no other preferences for curly brackets.

The main advantage is that namespace and classes and methods are clearly lined up using this style and, when used at that level, why not use it throughout.

Some exceptions exist, however, where all the empty lines doesn't add anything, for example:

public DbSet<Sample> Samples { get; set; }

/gustav
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to copy file 14 81
Create a Dropdown list with sub group 10 37
Fastest way to get file count in MS Server 2012 3 32
.NET Redemption/Outlook Examples 3 24
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question