zondag 20 april 2008

using directives within namespaces

Sometimes, I come across code examples where the programmer puts his using directives within the namespace declaration, like this:

namespace MyNamespace
{
using System;
using System.Data;

using SomeOtherNamespace;

public class MyClass
{
}
}

I am used to put my using directives outside the namespace block (which is no surprise, since VS.NET places them by default outside the namespace declaration when you create a new class):

using System;
using System.Data;

namespace MyNamespace
{
public class MyClass
{
}
}

So, I'm wondering: what are the advantages of placing the using directives within the namespace declaration ?
I've googled a little bit, but I haven't found any clue why I should do it as well. Maybe you'll know a good reason, and can convice me to adapt my VS.NET templates ?