开发者

How many newlines should a Mono application use between "using" statements, and the namespace declaration?

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

Which is better:

using Something;
using SomethingElse;


namespace SomeNameSpace {
   开发者_StackOverflow中文版 ...

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.


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.


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;)).


What is most appealing to you? Use that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜