Article View: borland.public.csharpbuilder.language.csharp
Article #236Re: event versus simple delegate
From: Joanna Carter [TeamB]
Date: Sat, 29 Jul 2006 15:42
Date: Sat, 29 Jul 2006 15:42
35 lines
1773 bytes
1773 bytes
"Francois PIETTE [ICS - MidWare]" <francois.piette@overbyte.be> a οΏ½crit dans
le message de news: 44cb7da5$1@newsgroups.borland.com...
| Porting to C#, I can create C# events corresponding to Delphi events. But
| those C# events will of course be unicast only.
Not necessarily :-) .C# delegates are always multicast, but you can assign
only one handler if you wish.
public delegate void TestHandler(int value);
{
private void HandleTest(int value)
{
// handler code
}
private TestHandler test;
private void CallTest()
{
test = HandleTest; singlecast
test(123);
test += HandleTest; // now multicast
}
}
You can see that both assigning (singlecast) and += (multicast) are both
available.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
Technical Details
Message-ID:
<44cb81eb@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.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-mailReferences:
<44cb7da5$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,62beb5b391211bf0 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII From: "Joanna Carter [TeamB]" <joanna@not.for.spam> Newsgroups: borland.public.csharpbuilder.language.csharp References: <44cb7da5$1@newsgroups.borland.com> Subject: Re: event versus simple delegate Date: Sat, 29 Jul 2006 16:42:20 +0100 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 82.69.239.102 Message-ID: <44cb81eb@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1154187755 82.69.239.102 (29 Jul 2006 08:42:35 -0700) X-Authenticated-User: jcarter Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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