ManualResetEvent and Dispose

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

Do I need to dispose a ManualResetEvent object?
The Dispose method is protected so I can't call it directly but it looks
like it is using a windows Event handle and so would need to be disposed!

Thanks in advance

Peter
 
Peter Chapman said:
Do I need to dispose a ManualResetEvent object?
The Dispose method is protected so I can't call it directly but it looks
like it is using a windows Event handle and so would need to be disposed!

The overridden Dispose method (with a boolean parameter) is protected,
but MarshalByRefObject implements IDisposable explicitly, so you can
cast to IDisposable and dispose it. Alternatively, I believe calling
Close on it is equally effective.
 
Back
Top