[Mono-dev] Coding guidelines confusion on braces

Andreas Nahr ClassDevelopment at A-SoftTech.com
Mon May 26 18:25:34 EDT 2008


> On Mon, 2008-05-26 at 19:48 +0200, Gert Driesen wrote:
> > Can someone clear up the confusion on whether braces should be on the
> same
> > line as the class/namespace declaration, or on the next line?
> 
> This is unofficial (as you're right, the published Coding Guidelines
> are
> vague on this point), but I believe that any construct that can be used
> with generic types should place the '{' on a newline, and anything that
> can't be used with generics should use the same line.
> 
> So `namespace' would always have '{' on the same line:
> 
> 	namespace Foo {
> 
> while class, struct, and method declarations would use a new line.  The

I'd put namespace { on a new line. It just makes the whole thing more readable, and because there usually is only one namespace/class declaration per file there is no real point in saving screen space either (that makes sense for simple properties, or if-blocks).

Andreas



More information about the Mono-devel-list mailing list