Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Performance: What affect does using have...
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00783193
Message ID:
00783227
Views:
12
Hi Victor,

The using statement (or Imports statement for VB.NET) affects performance in the IDE but not the execution of the code. When the code is compiled, the compiler will use the using statements to resolve where to find the different classes. The more using statements you have, the more checking it will do. For VB.NET, there is even more of a performance hit since it has background compiling that C# does not offer. Once the code is compiled, all the references have been resolved and the code will not perform any differently.

>Using the "using..." Statement reduces the verbosity of code in .NET. However, does it affect performance if you're issueing a "using..." Statement to include a namespace you'll never use?
>
>Say for example:
>
>using System;
>using System.Data;
>using System.Data.SqlClient;
>using System.Data.OleDbClient;
>
>...
>
>In this case you'll always use the SqlClient but do you get a performance hit for including OleDbClient if you never use it?
>
>Should I be cautious about what namespaces I include? More importantly should I be cautious about how I group my custom classes in certain namespaces?
>
>TIA
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform