C# and destructor calling
I am trying to understand a new challenge that I came across... I am putting the code below, well I have added a couple of things and made it extremely generic for this question... it won't execute for the obvious reasons.. class Class { public void class() { x statements; } ~Class() { y statements; } } static void Main(string[] args) { 1 new Class(); 2 Class history = new Class(); 3 history.class(); } So in Main.. if there is only line 1 in main, it goes straight to the Class destructor skipping class and executes the y statements....but I am assuming this is because class is not being called. However, if I have all three lines, it calls to class and executes x statements, then it executes y statements twice. Wouldn't it execute y statements, then x statements then go back and finish out with y statements again?