Finalizable Disposable Class : Destructor : Class Interface C# Source Code


Custom Search

C# Source Code » Class Interface » Destructor »

 

Finalizable Disposable Class








    
 

using System;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        using (MyResourceWrapper rw = new MyResourceWrapper()) {
        }
        MyResourceWrapper rw2 = new MyResourceWrapper();
        for (int i = 0; i < 10; i++)
            rw2.Dispose();
    }
}

public class MyResourceWrapper : IDisposable {
    public void Dispose() {
        Console.WriteLine("In Dispose() method!");
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Class Interface
» Destructor