• Advertisement
Sign in to follow this  

C# default curly bracket placement... ?

This topic is 2405 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement