Guidelines for Curly Braces in C#

You want to know where to place curly braces when defining a block of C# code.

Open and close curly braces on a line of their own.

Some folks like to use the C convention of placing open curly braces on the same line as the statement that defines the block. This style is fine as long as everyone working on the code consistently applies it. It’s a matter of preference that’s typically a choice between code readability and conciseness. I choose readability.


// This style enhances readability.
void DoSomething(int x)
    if ( x == 0 )

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s