Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using var benefits
Message
De
27/05/2011 11:04:12
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
27/05/2011 10:45:43
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows XP SP2
Divers
Thread ID:
01512055
Message ID:
01512060
Vues:
53
Craig,

I agree with you. I am using var where the type is obvious or listed as in the example below. If the object is returned from a method and it is not so obvious I think it is far more readable to declare the type explicily. My concern was if there were any performance benefits or detriments to using it.

Thanks for your input.

>No.
>
>But I think it has bigger implications as it makes it harder to read the code and understand what it does. I only use var for things like LINQ, where you aren't quite sure what the resulting value will be.
>
>>Hi all,
>>
>>Is there any performance benefits to using or not using var to declare objects?
>>
>>Is this better in some way (or not)
>>
>>DBRange range = new DBRange();
>>
>>over this:
>>var range = new DBRange();
>>
>>Thanks
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform