What's the benefit of organize and removing using statements?
If a reference is removed from your code via a using statement, does it help performance at all if it's already being used in another part of the application? I would think not -- however, I can see that it might help if the library is not in memory. Anyone have any info on this?
Mahesh ChandPosted Nov 14, 2008, 3:02 PM
Alan is correct.
It just makes code messy typing all that long namespace for each class.
AlanPosted Nov 14, 2008, 12:39 PM
The using directive is purely a compile time mechanism for shortening (or aliasing) the names of types. So, if you have:
using System.Windows.Forms;
you can just use Form instead of System.Windows.Forms.Form in your application. The C# compiler will fully specify the type in the MSIL it generates and so the use of the using directive makes no difference to runtime performance at all.
If you add reference to dlls to your application, the dlls won't be loaded unless and until you use entities from them within the application. So, including references to superfluous dlls, shouldn't impact on runtime performance either.