Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1.       private bool disposed = false;
  2.  
  3.       ~BaseClass()
  4.       {
  5.         if(!disposed)
  6.         {
  7.           DisposeNative();
  8.         }
  9.       }
  10.  
  11.       public void Dispose()
  12.       {
  13.         if(!disposed)
  14.         {
  15.           DisposeNative();
  16.           DisposeManaged();
  17.         }
  18.       }
  19.  
  20.       protected virtual void DisposeNative()
  21.       {
  22.         // Implement this where needed in child classes
  23.       }
  24.  
  25.       protected virtual void DisposeManaged()
  26.       {
  27.         // Implement this where needed in child classes
  28.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement