title: Using config file in public class
body: <p>Is it possible to to load config file, that contains server connection, using class constructor and storing it in a public static string. For example,</p>
  
  <p>Config.xml</p>
  
  <pre><code>&lt;Config&gt;
    &lt;ConnString&gt; "server=...; user id =...; user pass=...; database=...";&lt;/ConnString&gt;
  &lt;/Config&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>namespace Connection.Settings
  {
  
  public class Settings
  {
      public Settings()
      {
      XmlDocument cfg = new XmlDocument();
      cfg.Load("Config.xml");
      connection = cfg.SelectSingleNode("/Config/ConnString").InnerText;
  
      }
  
  
      public static string connection;
      public string Connection
      {
          get
          {
              return connection;
          }
      }
  
      public static string ConnectionString = connection;
  }
  }
  </code></pre>
  
  <p>The reason for doing this is that connection could be shared by many apps and yet I could easily change the connection in xml file without any need to touch the applications.</p>