By mswatcher
via codeproject.com
Published: Oct 07 2008 / 19:47
If the source object has a longer lifetime than the listener, and the listener doesn't need the events anymore when there are no other references to it, using normal .NET events causes a memory leak: the source object holds listener objects in memory that should be garbage collected.
There are lots of different approaches to this problem. This article will explain some of them and discuss their advantages and disadvantages. I have sorted the approaches in two categories: first, we will assume that the event source is an existing class with a normal C# event; after that, we will allow modifying the event source to allow different approaches.
Add your comment
Voters For This Link (12)
-
mswatcher -
askorkin -
ksh2dzone -
alashcraft -
Topnotch -
jfpoilpret -
yGuy -
rivethead_ -
larsgregersen -
bscarr -
thinkingserious -
holmespc