views:

80

answers:

3

I can't find anything about this in the Mono Project Coding Guidelines.

Which is better:

using Something;
using SomethingElse;


namespace SomeNameSpace {
    ...

or

using Something;
using SomethingElse;

namespace SomeNameSpace {
    ...

I know it's not terrible important, but it can't hurt to do it right.

The Mono guidelines are different than those for .NET, but feel free to input .NET's answer to this question as well.

+1  A: 

I don't know the official Mono answer, but at work, we developed formatting standards based on what we all agreed on, as well as leaving room for flexibility for things we really didn't care to enforce. Such as this. Personally, I'd leave one line of space, and if you feel two lines make the code more readable, then use two (or three, or whatever makes you happiest;)).

FrustratedWithFormsDesigner
+2  A: 

Speaking for C# generally (not mono specifically): it makes no difference. I tend to leave one line of whitespace. Note that FxCop StyleCop would (with the default settings) actually tell you to re-order them:

namespace SomeNameSpace {
    using Something;
    using SomethingElse;

Oddly enough, LINQ-to-SQL / SqlMetal has a subtle bug (fixed in 4.0) relating to this distinction.

Marc Gravell
According to FxCop, Copyright information goes at the top of the page, and using statements go inside the namespace declaration, sorted in alphabetical order. Also, it's invalid to ever have 2 blank lines in a row, so the first example in the question would be "more wrong".
Will Eddins
A: 

What is most appealing to you? Use that.

Tim Jarvis