Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tips wanted for a .net newcomer
Message
De
19/02/2014 18:22:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01594688
Message ID:
01594733
Vues:
91
It's no big deal. You can hover over the class and find out where it comes from. using statements save lots of typing and make the code easier to read.


>My only tip, and I know I am swimming against the current, but it is something I hate, is to avoid using "using" directive (not the statement) unless used as an alias. For example, lots of samples you find omit the using, then when you try to use them you do not know where the heck they are supposed to be. In short, I abhor code like this:
>
>
>using System;
>using System.Windows
>using System.Diagnostics.EventLog;
>using System.Windows.Controls;
>.....
>
>WriteEntry(.....) // where the heck is this??
>....
>
>
>Much clear code, although verbose, which I do not mind:
>
>
>System.Diagnostics.EventLog.WriteEntry(....);
>
>
>Now you know exactly from where WriteEntry comes from. If you want to save typing, the alternative is using an alias directive
>
>
>using Logger = System.Diagnostics.EventLog;
>...
>
>Logger.WriteEntry(....);
>
>
>Anyways, I think I stand alone on this one, as everyone seems to love using "using" ...
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform