title: How can I define a variable as CONSTANT when retrieved from Web.Config?
body: <p>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.</p>
  
  <p>So, I was thinking, should you keep the settings in AppSettings in UPPERCASE (Assuming you name your constants with all UPPER case.)</p>
  
  <p>Also, should variables that get values from AppSettings be UPPERCASE?</p>
  
  <p>EG.</p>
  
  <pre><code>String MY_SETTING = ConfigurationManager.AppSettings["MY_SETTING"];
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>readonly String MY_SETTING = ConfigurationManager.AppSettings["MY_SETTING"];
  </code></pre>
  
  <p>But then I don't know how you could do this with an int:</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>I somehow feel dirty setting readonly variables to look like constants, but to me, stuff in the web.config are essentially constant.</p>
  
  <p>Suggestions?</p>