Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to declare the variable correctly?
Message
De
01/10/2012 17:12:10
 
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01553872
Message ID:
01554082
Vues:
49
>Up front declaration of dynamic results like LINQ make little sense. Sometimes there simply is no hard type you can cast to because the result is anononymous. That's what the var type inferrance is all about...
>
>If find up front declarations both distracting (noise and extra code at the beginning of a method) and inhbiting work flow. Everytime you declare a new variable you have to move up to the top to add the declaration first - that's quite a bit of extra work IMHO, that doesn't yield any appreciable improvement in readability.

I understand that but, IMHO, I did find more advantages doing it within a respective order. For example, if I would see more examples like that on the net, it would be much easier for me, at least, to understand what is being declared and how. This reminds me when I see a line which contains a line, within a line, within a line... This makes it extremely difficult to maintain as we have to break it up. Some developers try to develop an entire application in one single line. :) At least, this is the feeling I get when I see some samples like that over the net. Thanks for the feedback, this is always appreciated.

>In Visual Studio you can ALWAYS know what a value's type is regardless of how it was declared. Just hover over the variable and Intellisense will show you what it's cast to even if it's declared as var.

...for as long as this is the environment. Once moved into a new development environment, such as was the case from VFP to .NET, proprietary design environment might not apply.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform