Accessing Constants Static Class That References App Settings Config File
<p>I have a class called LocalConstants....</p>

<pre><code> public static class LocalConstants {
    public static string DM_PATH = ConfigurationManager.AppSettings["DMQueue"];
    public static string PROJECT_PATH = ConfigurationManager.AppSettings["MSQueue"];
 }
</code></pre>

<p>When trying to access this class in my main program I am getting a null reference exception. Anything from ConfigurationManager.AppSettings[ is always null. But if I write</p>

<pre><code>  //The value is returned fine 
  string bo=ConfigurationManager.AppSettings["MSQueue"];
</code></pre>

<p>this compiles fine but is always null and throws a NullRefexception</p>

<pre><code>   string moomoo = LocalConstants.PROJECT_PATH;
</code></pre>

<p>The exception is
The type initializer for 'TestCodeOutOnSide.LocalConstants' threw an exception.</p>

<p>The innerException is the basic
Object reference not set to an instance of an object.</p>

<p>Even if I change the PROJECT_PATH to </p>

<pre><code>public static readonly string PROJECT_PATH = @"FORMATNAME:DIRECT=OS:serus-nickl\RMQDEV";
</code></pre>

<p>I get the same exception</p>

<p>Any ideas?</p>
