Article View: borland.public.csharpbuilder.language.csharp
Article #50Re: Custom Delegation
From: Andre
Date: Mon, 29 May 2006 14:04
Date: Mon, 29 May 2006 14:04
38 lines
2246 bytes
2246 bytes
> almost anything could happen.
> The best practice is probably to always remove the events.
by this you mean that i should define special 'remove' for my event like
{
public event eventHandler onEvent
{
remove {//// some cleanup code }
}
and then use -= in object dispose.
}
or
{
just use the -= in object dispose.
}
"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:15xbx0js9z62p.dlg@dlg.marcrohloff.com...
> On Mon, 29 May 2006 09:20:28 +0200, Andre wrote:
>
>> 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?
>
> What Joanna said is true but since you showed a custom implementation
> almost anything could happen.
> The best practice is probably to always remove the events.
>
> --
> Marc Rohloff [TeamB]
> marc rohloff -at- myrealbox -dot- com
Technical Details
Message-ID:
<447aff84@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<447aa0bd@newsgroups.borland.com> <15xbx0js9z62p.dlg@dlg.marcrohloff.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,bb4758d9cad65d98 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Andre" <andretruter@webmail.co.za> Newsgroups: borland.public.csharpbuilder.language.csharp References: <447aa0bd@newsgroups.borland.com> <15xbx0js9z62p.dlg@dlg.marcrohloff.com> Subject: Re: Custom Delegation Date: Mon, 29 May 2006 16:04:49 +0200 Lines: 40 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: <447aff84@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1148911492 196.207.45.253 (29 May 2006 07:04:52 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail