title: Struct and IDisposable
body: <p>I wonder why does it not compile?</p>
  
  <pre><code>public static void Main(string[] args)
  {
      using (MyStruct sss = new MyStruct())
      {
  
          sss.s = "fsdfd";// Cannot modify members of 'sss' because it is a 'using variable' 
  
          //sss.Set(12);    //but it's ok
      }
  }
  
  public struct MyStruct : IDisposable
  {
      public int n;
      public string s;
  
      public void Set(int n)
      {
          this.n = n;
      }
      public void Dispose()
      {
          Console.WriteLine("dispose");
      }
  }
  </code></pre>
  
  <p><strong>UPDATE</strong>:
  But it works perfect. Why?</p>
  
  <pre><code>public static void Main(string[] args)
          {
  
              using (MyClass sss = new MyClass())
              {
                  sss.Field = "fsdfd"; 
              }
  
  
          }
  
  public class MyClass:IDisposable {
  
      public string Property1 { get; set; }
      public string Field;
      public void Method1 (){}
  
      public void Dispose()
      {
          Console.WriteLine("dispose class");
      }
   }
  </code></pre>