Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


C# default curly bracket placement... ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 BUnzaga   Members   -  Reputation: 267

Like
0Likes
Like

Posted 23 June 2011 - 02:07 AM

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"][size="2"][source lang="csharp"][/size][/color]Method_Name(){}[/source]

However, I have really grown to like it like this:
[color="#1C2837"][size="2"][source lang="csharp"][/size][/color]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

Sponsor:

#2 __sprite   Members   -  Reputation: 461

Like
1Likes
Like

Posted 23 June 2011 - 02:25 AM

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.

#3 BUnzaga   Members   -  Reputation: 267

Like
0Likes
Like

Posted 23 June 2011 - 02:28 AM

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!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS