I
Ivan Neganov
Hi,
I have a custom subclass of System.IO.Stream type. I
wonder how to correctly implement the IDisposable pattern
in this situation.
The parent Stream type apparently uses explicit interface
implementation, and I could not find a way for my child
type to override parent's IDisposable.Dispose() method.
The intention was to clean up child's resources first,
then call parent's Dispose() method.
What first comes to mind is to inherit the IDisposable
interface directly in my child type, despite the parent
already does so, and implement my own Dispose pattern like
Jeff Ricther recommends in his book.
On the other hand, the Framework types like FileStream
seem to somehow override their parent Stream's Dispose()
method...
Any ideas?
Thanks,
Ivan.
I have a custom subclass of System.IO.Stream type. I
wonder how to correctly implement the IDisposable pattern
in this situation.
The parent Stream type apparently uses explicit interface
implementation, and I could not find a way for my child
type to override parent's IDisposable.Dispose() method.
The intention was to clean up child's resources first,
then call parent's Dispose() method.
What first comes to mind is to inherit the IDisposable
interface directly in my child type, despite the parent
already does so, and implement my own Dispose pattern like
Jeff Ricther recommends in his book.
On the other hand, the Framework types like FileStream
seem to somehow override their parent Stream's Dispose()
method...
Any ideas?
Thanks,
Ivan.