一个类的析构问题!
											using System;
class A
{
    public A()
    {
        Console.WriteLine("类A被创建立");
    }
    ~A()
    { Console.WriteLine("类A被释放"); }
}
class Test
{
    static void Main()
    {
        for (string s = ""; s != "end"; s = Console.ReadLine())
        {
            new A();
            for (int i = 0; i < 50; i++)
            {
                byte[] b = new byte[1000];
            }
        }
    }
}
此程序理论上应该是运行了5次占满第0代空间的256K,开始执行垃圾回收机制,大家也试试,为什么我一定要输入 END结束程序了 才执行析构呢?



 
											





 
	    

 
	

