Yes, but still I just didn't see it as being particularly safe. While it may
be safe in the dataset, I'm just afraid that down the line some developer
will see this happening in our lower level library, think it's a great short
cut to skirt having to dispose of your objects properly (i.e. at the right
time) and start copying the behaviour with impunity. Which is why I kind of
wanted to get all of that kind of code out of our lower level libraries even
if in the end it makes absolutly no difference.
Besides, knowing microsoft you're putting your self at risk that in some
future revision of the framework prematurly calling dispose on a dataset
will all of the sudden become unsafe, and we'd really be in a bind then.
Carlo
"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news

D2C9259-55FD-4378-908E-(E-Mail Removed)...
> Carlo,
>
> AFAIK does the dispose of a DataSet nothing as long as there is a
> reference to the DataSet or that the DataSet has a reference (which mostly
> is because it has some tables).
>
> I have tried this some years ago and I thought that it was the behaviour.
>
> But there seems to be some maniaks who think that the dispose in .Net is
> the same as deconstructing.
>
> Cor
>
> "Carlo Razzeto" <(E-Mail Removed)> schreef in bericht
> news:0A76CA20-B5AF-4330-9EE1-(E-Mail Removed)...
>> Hey,
>>
>> Some one gave a new developer of ours a project to make sure our core
>> library funcitons are properly cleaning up resources (that's a good
>> thing!), but I had consernse about one thing the developer was doing
>> which sparked a debate with my co-worker.
>>
>> Some of these functions were returning DataSet objects, and the developer
>> was calling the Dispose() function on the datasets inside the finally
>> portion of a try block. For me, this kind of raised a red flag, because
>> it seems to me the funciton is then returning an object which it has
>> already "cleaned up". In some cases an "end programmer" might even want
>> to take this dataset, modify datarow values and call a
>> DataAdapter.Update() on it. It just doesn't seem like a very safe
>> practise to me.
>>
>> Am I being overly cautious here? I guess I just have a problem with
>> returning "cleaned up" object in general, to me it seems like no good can
>> come from that. Thanks for your thoughts,
>>
>> Carlo
>