C# default curly bracket placement... ?

Started by
1 comment, last by BUnzaga 12 years, 10 months ago
Hey I just started learning C# (coming from JavaScript), and wanted to know, is there a way to change the default placement of the curly brackets?

I am using Microsoft Visual C# 2010 Express. I also have the full MSVS2008, but figured I should learn on the latest stuff... well anyway.

For example, it always defaults to:
[color="#1C2837"][source lang="csharp"]
Method_Name()
{
}
[/source]

However, I have really grown to like it like this:
[color="#1C2837"][source lang="csharp"]
Method_Name(){
}
[/source]

I don't supposed anyone knows how to change this? I tried to look it up on google, but it usually returns tutorials on how to code, or program, etc not the actual layout of C#.

It may not seem like this matters, but I think I am a bit ocd (which is probably why I am a programmer), and it is slowing down my programming speed to have to go through manually EVERY TIME I add a new method, class, if iteration, switch, for loop, while loop, etc to have to change these. Then on top of this, they seem to want to revert back to the 'other' way when I add nested content.

I would really appreciate it if anyone could point me in the right direction.

Bunzaga
Advertisement
In MSVS 2008, go to Tools->Options ->Text Editor->C# and look at the various options under Formatting. I imagine it's somewhere similar for 2010.

I used to prefer your method for curly braces, but I actually quite like the first one now. Letting Visual Studio do its default formatting gives everything a nice standard "C#" look IMHO.
Hey thanks! I actually also found it (finally). I was about to post the source and the steps, but you did it for me!

I usually do find my own answers, but as it had been a couple days of an occasional search here and there, I thought I would ask.

Thanks again!

This topic is closed to new replies.

Advertisement