This has to have been asked lots of times, yet I cannot find a single place in the internet mentioning the problem.
The situation is too simple to believe it has no solution:
public class BaseDispose : IDisposable
{
void IDisposable.Dispose()
{
}
}
public class ChildDispose : BaseDispose, IDisposable
{
void IDisposable.Dispose()
{
//var disp = base as IDisposable;
//(base as IDisposable).Dispose();
}
}
There is a base class that has unmanaged resources. For some reason it disposes of them via an implicit realization of IDisposable. There is a class that derives from this base class that has to get rid of both his own and his parent's resources.
How can this be done in c#? Both lines I commented out above result in a compilation error