views:

53

answers:

1

Why are the using statements inside of the namespace in Silverlight 4/VS 2010 auto-generated code?

The new convention seems to be

namespace myNamespace
{
    using System.Windows.Controls;
    using System.Windows.Navigation;
    . . .

    public myClass() {}
}

rather than the standard:

using System.Windows.Controls;
using System.Windows.Navigation;

namespace myNamespace
{

    . . .

    public myClass() {}
}

Is there any reason for this or an advantage to this, or is this just how they did it?

+1  A: 

Mostly stylistic preference. There is the very slight advantage that if you use multiple root namespaces in the same file, the usings are scoped to the namespace.

ie.

namespace Foo { using Blah; }
namespace Bar { /* No Blah context here */ }
Gary Linscott