Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# discussion: Redundant class names?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01334856
Message ID:
01334908
Vues:
13
>I thought they originally didn't want 'var'. Doesn't it go against the C# design principle of strong typing?
>

Not at all. It's still strongly-typed. It's just that now the compiler and Intellisense is smart enough to infer the type based on the return type. When you use var you aren't saying "I don't won't know it's type until later", but instead, "Hey, compiler, figure out the correct type for me". "var" was actually necessary to allow for anonymous types, which was necessary for LINQ. It's kind of interesting if you look at the language elements added to 3.5 how many of them were required in order to get LINQ working.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform