implementation of IDisposable : IDisposable : Class C# Examples


C# Examples » Class » IDisposable »

 

implementation of IDisposable









    
using  System;

class  MyClass:  IDisposable
{
          private  bool  Disposed  =  false;

          public  void  Dispose()
          {
                      Dispose(true);
                      GC.SuppressFinalize(this);
                    

          }
          private  void  Dispose(bool  disposing)
          {
                      if(!this.Disposed)
                      {
                                    if(disposing)
                                    {
                                              //free  any  managed  resources
                                    }

                                    //free  unmanaged  resources
                      }
                      
                      Disposed  =  true;
          }
          ~MyClass()
          {
                      Dispose(false);
          }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» IDisposable