Advertisement
pushrbx

Untitled

Mar 30th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. public class TestClass : IDisposable
  2. {
  3.     private SapAcqDevice m_device;
  4.  
  5.     public TestClass()
  6.     {
  7.  
  8.     }
  9.  
  10.     private void Dispose(bool disposing)
  11.     {
  12.         if (disposing)
  13.         {
  14.             m_device.Destroy();
  15.             m_device?.Dispose();
  16.         }
  17.     }
  18.  
  19.     public void Dispose()
  20.     {
  21.         Dispose(true);
  22.         GC.SuppressFinalize(this);
  23.     }
  24.  
  25.     ~TestClass()
  26.     {
  27.         Dispose(false);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement