title: C# get, set properties
body: <p>I have the following code:</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          Class1 myClass = new Class1("ttt");
          myClass.Name = "xxx";
          MessageBox.Show(myClass.Name);
      }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Class1
  {
      string str = "";
  
      public Class1(string name)   
      {
          str = name;
      }
  
      public string Name
      {
          get { return str; }
          set;
  
      }
  }
  </code></pre>
  
  <p>Initially I set:</p>
  
  <pre><code>  myClass.Name = "ccc";
  </code></pre>
  
  <p>but later changed it to:</p>
  
  <pre><code>  myClass.Name = "xxx";
  </code></pre>
  
  <p>and also changed:</p>
  
  <pre><code>  set {str = value;}
  </code></pre>
  
  <p>to: </p>
  
  <pre><code>  set;
  </code></pre>
  
  <p>Why when I run it do I get "ccc" instead of "xxx" ?</p>
  
  <p>In my current code there is "ccc".</p>