请看下面的代码。析构函数永远不会被调用。任何人都知道为什么以及如何纠正这种情况?
public partial class Form1 : Form
{
private Goo goo;
public Form1()
{
InitializeComponent();
goo = Goo.GetInstance();
}
}
public class Goo
{
private foo f = new foo();
private static Goo goo;
private Goo()
{}
public static Goo GetInstance()
{
if(goo!=null)
{
goo = new Goo();
}
return goo;
}
~Goo()
{
}
}
class foo
{
~foo()
{
}
}