473,385 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Finding out number of subscribers to an event

Hello,

Is it possible to find out how many methods are listening to a certain
event? For example, if a number of methods subscribed to a controls DragDrop
event using +=, can I find out how many methods in total are listening to the
DragDrop event of the control?

If I can't find out the exact number of methods listening to the DragDrop
event, can I somehow remove all listeners of that event at once? I tried
using m_Control.DragDrop = null, but the compiler says I'm only allowed to
use DragDrop with += or -=.

I read about GetInvocationList() but I only found examples of its usage on
custom delegates. Im not sure if/how it is applicable to a controls DragDrop
event.

Thanks for your help,
-Flack
Nov 17 '05 #1
1 1681
Flack <Fl***@discussions.microsoft.com> wrote:
Is it possible to find out how many methods are listening to a certain
event?


No - at least, not portably. One of the main points of an event as
opposed to a delegate is that you only have access to
subscribe/unsubscribe, not to the underlying delegate itself.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2

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

Similar topics

0
by: Flack | last post by:
Hello, Is it possible to find out how many methods are listening to a certain event? For example, if a number of methods subscribed to a controls DragDrop event using +=, can I find out how many...
2
by: Steve Wilkinson | last post by:
Is there any method I can use to determine the number of subscribers to a controls events. In particular I'm looking at the ComboBox.SelectedIndexChanged event, I have a scenario where I need to...
6
by: Peter M. | last post by:
Hi all, If an event has multiple subscribers, is it possible to cancel the invocation of event handlers from an event handler? Or to be more specific: I'm subscribing to the ColumnChanging...
2
by: Ron M. Newman | last post by:
Hi, My class has an event to which other classes subscribe (e.g. myevent+= foreignDelagate). I'd like to find out how many subscribers "myEvent" has. Up till now I tested it for "null" or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.