Exemplo n.º 1
0
        static void Main(string[] args)
        {
            DestructorDemo obj1 = new DestructorDemo();
            DestructorDemo obj2 = new DestructorDemo();

            //obj1 = null;
            obj2 = null;
            GC.Collect();
            // Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            DestructorDemo d1 = new DestructorDemo();

            //DestructorDemo d2 = new DestructorDemo();
            d1 = null;
            //d2 = null;
            // GC.Collect(); //if there are any unused objects associated with the program will be destroyed
            // in the middle of the program execution.
        }