The Visual Studio IDE allows me to scan for unused references in VB.NET source code. But I also have a lot of unused Imports statements in my application.
Two questions:
Imports
statements throughout my VB.NET source code?Imports
statements hurt the performance of my application?It doesn't hurt runtime performance at all, the only time those using directives are actually used is at compile time.
The three reasons why you could want to keep your import count low are :
For clarity sake. Imports are a usefull way to learn at first glance what kind of operations a class is performing : don't waste this opportunity ! (eg if I see a Regex namespace imported on top of a file, I usually assume there's some regex work in it)
The more imports you have, the more likely you are to run into a name clash (ie having one type name refering to two different types in two different imported namespaces)
Since those directives are used at compile time, having lots of unused import could hurt buildtime and/or intelliSense performance. (Just speculating here, I don't know how IntelliSense is working behind the scenes)
If you want to get rid of those useless namespaces, I don't think there's any built-in support for that in Visual studio (I assume this is what you meant by "the VB.net IDE"), but you can either use some third party tools (eg Resharper) or some other IDEs (eg Eclipse.net)
I believe this inclusion is done at compile time, and only on demand.
In other words, no performance penalty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With