Curly Braces - The solution to the war
I'm the type of guy that prefers his curly braces to be at the same line as the method but I know there's alot of people that wants the curly braces on new lines. I'm aware of the coding conventions that supports that way of coding. However, I cannot bare to read code like that, but I also know that "the others" cannot bare to read my style of curly braces. However I think my argument that I save document rows is a pretty strong one.
Same-line-style
-
public string Message {
-
get {
-
return txtMessage.Text;
-
}
-
set {
-
txtMessage.Text = value;
-
}
-
}
New-line-style
-
public string Message
-
{
-
get
-
{
-
return txtMessage.Text;
-
}
-
set
-
{
-
txtMessage.Text = value;
-
}
-
}
The Solution
So discussing this with a friend who is an advocate of the new-line-principle I decided to create a macro that switches between the two rules. Tada! Now all you have to do when looking at another developers source code is to run the macro to make the code readable to you, do the needed changes and then run the macro again to switch back to his curly-brace-style.
How it works
I simply change the new line formatting rules for your VS and reformats all your code
Compability
- Only functions with Visual Studio 8 (VS 2005) and above. If you feel that you have to much time on your hands you are welcome to rewrite it for older versions of Visual Studio.
- Rules only apply to J# and C# code.