#usings location

Topics: Developer Forum
Developer
Dec 24, 2006 at 2:23 PM
I would prefer placing of #usings which refer to our sub-namespace inside the namespace scope. It makes a clear distiction what is external and what is local. Moreover, if we were doing any reorganization in the future, the following form is less likely to break.

using System;
using System.Text;
 
namespace Pscx.Commands.FileSystem
{
    using Interop;
    using Visitors;
 
    // .
    // .
    // .
}
Coordinator
Dec 24, 2006 at 7:05 PM
Well I have at least one problem with that:

namespace Pscx.Commands.FileSystem
{
using Interop;
using Visitors;
...
}

doesn't tell me where Interop and Visitors fit in. Sorry but I have never seen nor used code that places using namespace statements within a namespace so I'm not familiar with the rules. Also, I like to be able to quickly glance at the top of a file to see what namespaces are in use. Besides we really should be only putting one significant chunk functionality in a file (one file per type) so this wouldn't be an issue in this case. Finally, I use CodeRush to refactorings like that aren't much of a problem for me. :-)

So I guess my vote would be to leave the Pscx* using statements at the top just under the System and Microsoft using statements.