title: Set value of a static variable using a function
body: <p>I have declared some static variables in my solution as below, </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  
  namespace SSPWAS.Utilities
  {
      public class Constants
      {
          public static string ApproverlevelL1 = "M23";
          public static string ApproverlevelL2 = "Cre";
          public static string ApproverlevelL3 = "Free34";
          public static string ApproverlevelL4 = "CDF";
          public static string ApproverlevelL5 = "FM";
      }
  }
  </code></pre>
  
  <p>My question is, If i try to set it the like below then i get the error as :</p>
  
  <blockquote>
    <p>An object reference is required for the non-static field, method, or
    property</p>
  </blockquote>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  
  namespace SSPWAS.Utilities
  {
      public class Constants
      {
          public static string ApproverlevelL1 = getLevel("1");
          public static string ApproverlevelL2 = getLevel("2");
          public static string ApproverlevelL3 = getLevel("3");
          public static string ApproverlevelL4 = getLevel("4");
          public static string ApproverlevelL5 = getLevel("5");
      }
  }
  
  public string getLevel(string levelID)
  {
    string levelName;
    //logic here
    return levelName; 
  }
  </code></pre>
  
  <p>So how can i achieve this?</p>