Guest User

Untitled

a guest
Aug 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. IDisposable implementation - What should go in 'if (disposing)'
  2. // Dispose(bool disposing) executes in two distinct scenarios.
  3. // If disposing equals true, the method has been called directly
  4. // or indirectly by a user's code. Managed and unmanaged resources
  5. // can be disposed.
  6. // If disposing equals false, the method has been called by the
  7. // runtime from inside the finalizer and you should not reference
  8. // other objects. Only unmanaged resources can be disposed.
  9. protected virtual void Dispose(bool disposing)
  10. {
  11. if (!disposed)
  12. {
  13. if (disposing)
  14. {
  15. // Free other state (managed objects).
  16. }
  17.  
  18. // Free your own state (unmanaged objects).
  19. // Set large fields to null.
  20. disposed = true;
  21. }
  22. }
  23.  
  24. publisher.DoSomeEvent += subscriber.DoSomething;
Add Comment
Please, Sign In to add comment