title: When is my destructor called in this circumstance? (C#)
body: <p>I was wondering when the destructor is called under these circumstances, and if it is will it be called on the main UI thread?</p>
  
  <p>Let's say I have the following code, when would the destructor be called, and would it wait until I have finished all my function calls?</p>
  
  <pre><code>private void Foo()
    {
    MyObject myObj = new MyObject();
    DoSomeFunThingsWithMyObject(myObj);
  
    myObj = new MyObject(); //is the destructor for the first instance called now?
    DoLongOminousFunctionality(myObj);  
    }
    //Or will it be called after the DoLongOminousFunctionality?
  </code></pre>
  
  <p>It's just something that interests me, if the thread is interrupted at myObj = new MyObject(), or if the Destructor call waits until the Thread is free.</p>
  
  <p>Thanks for the information.</p>