473,748 Members | 8,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve all delegates registered for one event

Hi.

You can add new delegates for an event with += and you can remove delegates
from an event by using: -= but is there a way (method) to list all delegates
added to one event???

Sincerely
Greetings
Lore

Nov 15 '05 #1
2 3081
Hi Lore,

Yes, this is possible.
You can use the GetInvocationLi st() method in your event,
which returns the list of delegates that have been associated with
the event.

MyDelegate[] delegates = (MyDelegate[])MyEvent.GetInv ocationList();

Regards,
Aravind C
"Lore Leuneog" <Lo**********@g mx.net> wrote in message
news:bo******** *****@news.t-online.com...
Hi.

You can add new delegates for an event with += and you can remove delegates from an event by using: -= but is there a way (method) to list all delegates added to one event???

Sincerely
Greetings
Lore

Nov 15 '05 #2
Hi, Aravind

Thank you very much.
But it seems this doesn't work with build-in Form-Control-Events for example
this.Button.Cli ck-event?
(EventHandler[])this.button.Cl ick.GetInvocati onList();
Doesn't work?!

Or did I do it wrong?
Sincerely
Marane

"Aravind C" <ar***********@ nospam.hotmail. com> schrieb im Newsbeitrag
news:eL******** *****@TK2MSFTNG P10.phx.gbl...
Hi Lore,

Yes, this is possible.
You can use the GetInvocationLi st() method in your event,
which returns the list of delegates that have been associated with
the event.

MyDelegate[] delegates = (MyDelegate[])MyEvent.GetInv ocationList();

Regards,
Aravind C
"Lore Leuneog" <Lo**********@g mx.net> wrote in message
news:bo******** *****@news.t-online.com...
Hi.

You can add new delegates for an event with += and you can remove

delegates
from an event by using: -= but is there a way (method) to list all

delegates
added to one event???

Sincerely
Greetings
Lore


Nov 15 '05 #3

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

Similar topics

2
1062
by: Lore Leuneog | last post by:
Hi. You can add new delegates for an event with += and you can remove delegates from an event by using: -= but is there a way (method) to list all delegates added to one event??? Sincerely Greetings Lore
0
1110
by: Dave L | last post by:
I just upgraded from VS .NET 2002 to 2003. Everything built okay, but strange bugs started appearing. Apparently there is a bug in the managed C++ compiler in regards to handling of static __events. In short, every new instance of the class clears all existing listening registered delegates. It should, of course, preserve all delegates since its static, but it does not according to this: "The real problem is the instance constructor...
4
5829
by: Tim | last post by:
There are a set of clients who need to be notified of certain events. I have used events and delegates (publisher-Subscriber model) for the notification mechanism. All the clients register with the event publisher and subscribe for the events that they are interested in. When a certain event happens, the subscribers are notified about it. I want the clients to return a value after their callback method is called. If any of the client...
30
3650
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 underlying delegate is private, but is that all ? -- Regards
5
4397
by: renjini | last post by:
I am a starter in C# ... I will present my problem : I am wrapping a C dll in C#. The C dll exports a function which takes a structure MYSTRUCT holding 2 function pointers(callback functions). struct MYSTRUCT { ontest1 t1;
0
1048
by: renjini | last post by:
I am a starter in C# ... I will present my problem : I am wrapping a C dll in C#. The C dll exports a function which takes a structure MYSTRUCT holding 2 function pointers(callback functions).
1
1740
by: CB | last post by:
When designing an object, is there a best practice for how to allow the user of the object to tell the object to remove itself from any delegates / events it has registered with? For example.. say we have a static settings class, and it has some OnChange event. The object I am writing will add a method to the settings OnChange event in its constructor. Obviously, at some point, the method needs to be removed from the event so the new...
69
5584
by: raylopez99 | last post by:
They usually don't teach you in most textbooks I've seen that delegates can be used to call class methods from classes that are 'unaware' of the delegate, so long as the class has the same signature for the method (i.e., as below, int Square (int)). Here is an example to show that feature. Note class "UnAwareClass" has its methods Square and Cuber called by a class DelegateClass. This is because these methods in UnAwareClass have the...
4
1792
by: samadams_2006 | last post by:
Hello, I'm trying to figure out why delegates are such a great thing. For example, I came across the following line of code: "This ability to refer to a method as a parameter makes delegates ideal for defining callback methods. For example, a sort algorithm could be passed a reference to the method that compares two objects. Separating the comparison code allows the algorithm to be written in a more general way."
0
9537
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8241
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.