Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performance: What affect does using have...
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00783193
Message ID:
00783227
Vues:
13
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform