473,516 Members | 3,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

events.

is there any difference between events and multicast delegates.
if so how to differentiate.

thanx and regards.
Nov 15 '05 #1
4 1284
Events are just a representation of a collection of delegates. You can, if
you want, have a collection of delegates and call them yourself or you can
use the "+=" operator and add delegates to Events. They both achieve the
same thing.

-vJ

"suresh" <ge*****@microsoft.com> wrote in message
news:#j**************@TK2MSFTNGP09.phx.gbl...
is there any difference between events and multicast delegates.
if so how to differentiate.

thanx and regards.

Nov 15 '05 #2
thanx vijay.
but my question is please differentiate multicast delegates
from events.
thanx and regards.

"Vijaye Raji" <no************@hotmail.com> wrote in message
news:uN**************@tk2msftngp13.phx.gbl...
Events are just a representation of a collection of delegates. You can, if you want, have a collection of delegates and call them yourself or you can
use the "+=" operator and add delegates to Events. They both achieve the
same thing.

-vJ

"suresh" <ge*****@microsoft.com> wrote in message
news:#j**************@TK2MSFTNGP09.phx.gbl...
is there any difference between events and multicast delegates.
if so how to differentiate.

thanx and regards.


Nov 15 '05 #3
Vijaye Raji <no************@hotmail.com> wrote:
Events are just a representation of a collection of delegates. You can, if
you want, have a collection of delegates and call them yourself or you can
use the "+=" operator and add delegates to Events. They both achieve the
same thing.


Not quite. Events are more limiting to the outside world than
delegates. You can expose an event so that other classes can add and
remove handlers, but not fire the event themselves *or* remove all the
handlers by simply setting the event to null.

Also, an event can handle its add/remove accessors however it wishes
to. You needn't necessarily have a separate field for each event, for
instance.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #4
Suresh,
The way I understand it Events are to Delegate fields that Properties are to
other fields.

The event encapsulates & protects the underlying delegate value.

Chris Sells' book "Windows Forms Programming in C#" from Addison Wesley has
a chapter explaining the relationship. The story is also available on Code
Project:

http://www.thecodeproject.com/csharp...te_bedtime.asp

Hope this helps
Jay

"suresh" <ge*****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
is there any difference between events and multicast delegates.
if so how to differentiate.

thanx and regards.

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2011
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When DataNode is changed, it raises "Changed" event. The class has a reference to the DataNode it is being contained in: - DataTree - tree like data structure...
6
13232
by: Saso Zagoranski | last post by:
Hi! How can I unregister all the events registered to a control? I have seen a piece of code in another thread, which gets all the registered handlers for a specific event. Let's say I have a CustomTextBox : TextBox, which has quite a lot of events... Do I put unregistering code for all the possible events in the Dispose method? Or is...
14
12107
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using events since I never saw it used anywhere in MSDN documentation/samples?! Or it will just break when I upgrade to .NET Framework 2.x in the coming...
2
1842
by: Bob Rundle | last post by:
I have the following code, which appears to be working. However it doesn't look right. The part I am wondering about is the logic in DisconnectEvents(). This logic creates a new delegate and then expects to find that delegate in the list of event handlers. What is the proper way of writing this? Regards, Bob Rundle
4
22856
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on when to use one over another? If anyone could provide any additional info, your comments, best practices, any good articles, specific examples, etc....
11
1840
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I mean, for one, delegates point to subs, so when you call a delegate, why not just call the sub dierectly and not bother adding the extra code...
30
3608
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment it seems to me that Microsoft has developed similar functionality via two keywords. I do understand that an event offers better encapsulation as the...
5
4362
by: Richard Maher | last post by:
Hi, Here I mean "User" in the Programmer or Javascript sense. I merely wish to programmatically trigger an Event. It would be absolutely fantastic if there was a (Form level?) ONUSEREVENT() and a setEvent() function but, in the absence of this, is it not possible to use DOM to change an object's properties resulting in a state-change event?...
14
2196
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd, EventTimeBegin, Category FROM Events WHERE EventDateBegin >'01/01/2008' AND Events.Category LIKE '3' OR Events.Category LIKE '4' OR Events.Category LIKE '5'...
1
4880
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the events when click on that date that perticular event displyed in a text box.But my requirement is to when click on that date that related event...
0
7273
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.