title: Can a static member variable be used to cache a value in a static class?
body: <p>I've come across this piece of code where it looks like the original developer has tried to use a static string to cache a value in a static class.</p>
  
  <pre><code>public static class GetStringFromSomeProcess
  {
      private static string theAnswer;
  
      public static string GetString
      {
          get
          {
              if(theAnswer == null)
              {
                  theAnswer = GoGetTheAnswerFromALongRunningProcess();
              }
              return theAnswer;
          }
      }
  }   
  </code></pre>
  
  <p>As far as I can see this won't work, as you can't instantiate the <code>GetStringFromSomeProcess</code> class, <code>GoGetTheAnswerFromALongRunningProcess</code> will be called every time <code>GetString</code> is used. Am I missing something?</p>