Article View: borland.public.csharpbuilder.language.csharp
Article #43Custom Delegation
From: Andre
Date: Mon, 29 May 2006 07:20
Date: Mon, 29 May 2006 07:20
28 lines
1823 bytes
1823 bytes
I have a series of my own eventHandler delegates, and a few events using
these delegates. All works fine. Im just concerned about one thing.
In some litrature the author define a event like this:
public event eventHandler onEvent
{
add{/// some code}
remove{/// some code}
}
assuming which are used when doing:
myObj.onEvent += new eventHandler(this.onEventAction);
and
myObj.onEvent -= new eventHandler(this.onEventAction);
Now, is this a cleanup routine when using -= or does it just add additional
functionality to the event contruction/destruction?
Is this type of coding neccesary? good practice or mandatory for event
cleanup?
As far as I know, the object owning the event gets disposed by GC
automaticlly.
Should I call the -= manouver when the object gets disposed?
Thanks,
Andre
Technical Details
Message-ID:
<447aa0bd@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,bb4758d9cad65d98,start X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Andre" <andretruter@webmail.co.za> Newsgroups: borland.public.csharpbuilder.language.csharp Subject: Custom Delegation Date: Mon, 29 May 2006 09:20:28 +0200 Lines: 30 Organization: Bluewater Systems X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-Antivirus: avast! (VPS 0621-4, 05/26/2006), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 196.207.45.253 Message-ID: <447aa0bd@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1148887229 196.207.45.253 (29 May 2006 00:20:29 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail