我想知道在这些情况下何时调用析构函数,如果它是在主UI线程上调用它?
假设我有以下代码,什么时候会调用析构函数,它会等到我完成所有函数调用之后?
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?
如果线程在myObj = new MyObject()中断,或者Destructor调用等待直到Thread空闲,那么这只是我感兴趣的东西.
谢谢你的信息.