Re: Disposing by reflection?
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Wed, 13 Apr 2005 21:37:09 +0100
Steven Wolf <apoc69@xxxxxxx> wrote:
> I like to implement IDisposable in my classes
In all of them? That's a waste of time.
> but at a certain point its becoming boring when i have to take care about
> setting all members in a class to null..sometimes i forgot that also..
>
> but i could avoid that, by using reflection..just iterating thru all local
> members and set them null, but i guess this would slow down the code..
You don't need to set everything to null. It might *very occasionally*
help - if your class has references to objects in "younger"
generations, for example - but usually it's not particularly useful.
The important bit about IDisposable is to implement it when you have
unmanaged resources, or references to other objects which implement
IDisposable (and which you're responsible for).
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- References:
- Disposing by reflection?
- From: Steven Wolf
- Disposing by reflection?
- Prev by Date: Re: Socket Server to Socket Client..Client function not working when called from Server...
- Next by Date: Re: How to set local variables automatically?
- Previous by thread: RE: Disposing by reflection?
- Next by thread: Debugging a service
- Index(es):
Relevant Pages
|