Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Something like .h files in VFP
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00930980
Message ID:
00931137
Vues:
21
If its truly a constant why not declare it as such
//Constants.
public const string PageTitleText = "Home";
I put these at the top of my class instead of embedding "magic" numbers all over my code.

Enums also provide a type-safe way of keeping a list of values.

For values that might change after deployment app.config or web.config is a good place to put it.

Or you may find that error messages are best kept in a database table then you can create a user interface to maintain them. So the best place to put it really depends on how you are going to use it. Messages that will get translated might belong in resource files, for example.


>Sorry. English is not my first lenguage.
>
>In VFP exists .h files where is possible to define a constant and later any program doing (#include) can have access to these.
>
>Which is equivalent of this functionality in C # (if it exists)?
>
>Which is the best one practices to define constants (like for example all messages error, alert, etc) in a single part (it will be in a class)?
>
>Thanks for your comments.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform