Say, I have my own C# class defined as such:

public class MyClass
{
    public MyClass()
    {
        //Do the work
    }
    ~MyClass()
    {
        //Destructor
    }
}

And then I create an instance of my class from an ASP.NET project, as such:

if(true)
{
    MyClass c = new MyClass();
    //Do some work with 'c'

    //Shouldn't destructor for 'c' be called here?
}

//Continue on

I'd expect the destructor to be called at the end of the if scope but it never is called. What am I missing?

Edit
Report