title: How to declare/set a static variable inside a method
body: <p>I cannot get/set a static variable inside a method. How can I do it? </p>
  
  <pre><code>    public class LoginDialog
  {
      // class members
  
      private static string _user=""  ;
  
      public  void RunDialog()
      {
  
          _user = "Peter";
  
      }
  
      public static string _User { get; set; }
  
  }
  </code></pre>
  
  <p>After reading the answers I edit my code and I cant still get the static variable _user. What I am doing wrong?</p>
  
  <pre><code>    public class LoginDialog
  {   
      private static string _user;  
  
      public void RunDialog()
      {
         LoginDialog._user = "Peter";
      }
      public static string _User { get {return _user;}  }
  }
  </code></pre>
  
  <p>When I declare like that everything works fine, but rather I would like to declare inside the method.</p>
  
  <pre><code> private static string _user="Peter";
  </code></pre>