List Info

Thread: Creating disposible object




Creating disposible object
user name
2006-08-03 15:34:30
I have a theory question.

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?

The only alternative I can think of is this

public void GetData(ref DataSet);

in that case, the consumer has to create his DataSet and I
don't.
Emotionally it makes me feel like I'm not littering.

What's the right way to go?


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )