title: When is destructor called for C# classes in .NET?
body: <p>Say, I have my own C# class defined as such:</p>
  
  <pre><code>public class MyClass
  {
      public MyClass()
      {
          //Do the work
      }
      ~MyClass()
      {
          //Destructor
      }
  }
  </code></pre>
  
  <p>And then I create an instance of my class from an ASP.NET project, as such:</p>
  
  <pre><code>if(true)
  {
      MyClass c = new MyClass();
      //Do some work with 'c'
  
      //Shouldn't destructor for 'c' be called here?
  }
  
  //Continue on
  </code></pre>
  
  <p>I'd expect the destructor to be called at the end of the <code>if</code> scope but it never is called. What am I missing?</p>