Events unsubscribing and resource leaks?
- From: "Daniel" <DanielV@xxxxxxxxxxxxxxxx>
- Date: Thu, 28 Sep 2006 02:18:55 +0100
Hey guys
When you hook an event (c# 2.0 syntax): myEvent += MyMethodToFire;
You need to also unsubscribe it to avoid a resource leak so that the object
it is in gets garbage collected like so : myEvent -= MyMethodToFire;
That's all fine, but when you use visual studio to create events for objects
it never creates an unsubscribing reference, so is it puting in resource
leaks? Or is this being cleared somewhere that i am not seeing?
Also what is the best way to clean up a singleton class?
.
- Follow-Ups:
- Re: Events unsubscribing and resource leaks?
- From: Christof Nordiek
- Re: Events unsubscribing and resource leaks?
- Prev by Date: Re: About syntactic sugar
- Next by Date: Re: Different Form Size on different PCs (What can i DO????)
- Previous by thread: Filesystemwatcher created event
- Next by thread: Re: Events unsubscribing and resource leaks?
- Index(es):
Relevant Pages
|
Loading