Possible Duplicate:
Who should call Dispose on IDisposable objects when passed into another object?
Say you have a class with an interface like this:
public interface Foo
{
Load(IDisposable something);
}
When implementing this method, should I call dispose when done? In other words, when a method of a class takes a Stream
, Reader
or anything else which is IDisposable
, should this method dispose of the stream as well, or should this be left to whoever called the method?
I know either way would work, just curious what others more experienced would consider good conduct :-)