Say you have 3 classes that implement IDisposable - A, B and C. Classes A and B are both dependent on class C.
Would it be correct to say that classes A and B's typical implementation of Dispose() would be:
public void Dispose() { if (m_C != null) m_C.Dispose(); }
If there's an instance of A and and instance of B that share the same instance of C, how would you overcome the problem that disposing an instance of A would damage the instance of B?
Last minute addendum - If in point 2 it's a DI container that instantiates all instances, who is responsible for disposing of the objects? Is it the container itself? How?
Thanks, urig