Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Dispose() / Destructor Combo Platter *****");

            // Call Dispose() manually, this will not call the finalizer.
            MyResourceWrapper rw = new MyResourceWrapper();
            rw.Dispose();

            // Don't call Dispose(), this will trigger the finalizer
            // and cause a beep.
            MyResourceWrapper rw2 = new MyResourceWrapper();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Dispose() / Destructor Combo Platter *****");

            // Call Dispose() manually, this will not call the finalizer.
            MyResourceWrapper rw = new MyResourceWrapper();

            rw.Dispose();

            // Don't call Dispose(), this will trigger the finalizer
            // and cause a beep.
            MyResourceWrapper rw2 = new MyResourceWrapper();
        }