Handing out Disposable objects

Vince asks a question about handing out Disposable objects:

Lets say I have a class that has a method that returns a new DataSet:

public DataSet GetData();

I'll have no control over the DataSet being disposed.  As an object creator
is it my concern that the object I created eventually gets disposed or
should I not care and trust that the consumer of this method will do the
right thing?

A good thread to read.  I especially liked Frans’ response:

When you buy a happy meal at McDonalds, you're responsible for disposing the left overs and the rest of the trash, not Donald (sic) McD. 

No Comments