2

Is there any difference between these two using declarations ?

namespace myNamespace
{
    using System;
    using System.Collections.Generic;
    public class myClass
    {
    }
} 

AND

using System;
using System.Collections.Generic;
namespace myNamespace
{
   public class myClass
   {
   }
} 
yogi
  • 19,175
  • 13
  • 62
  • 92
  • 7
    possible duplicate of [Should Usings be inside or outside the namespace](http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace) And another dupe here: http://stackoverflow.com/questions/7288835/should-using-be-inside-the-namespace-or-outside Please use the `search` field in the upper right corner of this webpage before posting a question. Chances are your question is already answered. – Darin Dimitrov Jun 10 '13 at 06:55
  • question was closed before I could answer but this should help explain - http://pastebin.com/vk4Z8cGK. (Not saying you should code like this though) – Sayse Jun 10 '13 at 07:03

1 Answers1

0

The second one is considered "correct" and is a place where your colleagues would expect it to be. So even if there would be no differences (I don't know because I have never tried the first way), use the second one.

eMko
  • 1,147
  • 9
  • 22
  • 2
    Interestingly we're using version 1 at work and no one ever bothered. The official C# style guidelines also prefer version 2: http://msdn.microsoft.com/en-us/library/vstudio/w2a9a9s3.aspx - But I think as long as you're consistant it does not matter which you use. – JustAnotherUserYouMayKnow Jun 10 '13 at 07:04