I keep a lot of settings in AppSettings, and I was wondering if it's considered good practice to name them in UpperCase. Essentially, they're the same as Constants right? As I understand it, if you change the Web.Config, the app does a recompile.
So, I was thinking, should you keep the settings in AppSettings in UPPERCASE (Assuming you name your constants with all UPPER case.)
Also, should variables that get values from AppSettings be UPPERCASE?
EG.
String MY_SETTING = ConfigurationManager.AppSettings["MY_SETTING"];
What is the best way to handle these and make them look and feel like Constants? Is it even a good idea? The only way I could think of would be make it readonly:
readonly String MY_SETTING = ConfigurationManager.AppSettings["MY_SETTING"];
But then I don't know how you could do this with an int:
readonly String MAX_USERS_S = ConfigurationManager.AppSettings["MAX_USERS"];
readonly int MAX_USERS; // needs to be set here... won't compile
int.TryParse(MAX_USERS_S, out MAX_USERS);
I somehow feel dirty setting readonly variables to look like constants, but to me, stuff in the web.config are essentially constant.
Suggestions?