Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constants (such as 1 or 0) -> Int16 ?
Message
 
 
À
25/04/2014 13:54:38
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01599064
Message ID:
01599070
Vues:
33
>No, that's a magic number.
>
>The constant needs to be defined earlier
>
>const short maxAdmissionDays = 1;
>DateTime admission_end = this.dtScan.Date.AddDays(Math.Max(admissions, maxAdmissionDays).AddSeconds(-1);
>
>
Hmm, is it good practice? I can probably use this idea (the constant name should be min, though).

Thanks again.

Also, where and how should I declare it? At the top of the class code?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform