473,490 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

finding out the count of "subscibers" on an event

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 '!null" to find out if it has anything
there, but I need an exact number of subscribers. Is there any way to query
it?

Thanks!
-Ron
Jun 20 '06 #1
2 6395
Ron,

All events are delegate chains. If the instance of the delegate is not
null, you can call the GetInvocationChain method on the delegate to get the
invocation chain for it. It returns an array of delegates that constitute
the chain.

Then, you can just return the length of the array.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron M. Newman" <co**********@confideltial.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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 '!null" to find out if it has
anything there, but I need an exact number of subscribers. Is there any
way to query it?

Thanks!
-Ron

Jun 20 '06 #2
Yes, that's what I was looking for. Thanks!
-Ron

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ee*************@TK2MSFTNGP02.phx.gbl...
Ron,

All events are delegate chains. If the instance of the delegate is not
null, you can call the GetInvocationChain method on the delegate to get
the invocation chain for it. It returns an array of delegates that
constitute the chain.

Then, you can just return the length of the array.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ron M. Newman" <co**********@confideltial.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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 '!null" to find out if it has
anything there, but I need an exact number of subscribers. Is there any
way to query it?

Thanks!
-Ron


Jun 20 '06 #3

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

Similar topics

2
26298
by: Ken | last post by:
The fact that you can not reassign a variable in XSL is an endless source of frustration, causing you to jump through all sorts of non-intuitive hoops. In this case, however, the lack of...
1
4218
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
8
4262
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
2
1986
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
1
17225
by: michael.martinek | last post by:
Greetings! I've recently been trying to do something, which apparently looks like it may be a little odd.. I'm not finding anything in the manuals or anywhere on the web where something similiar...
9
2441
by: stevewy | last post by:
I am trying to write a function that will test all the checkboxes in a particular group of a form (it's a questionnaire), see whether more than three of them are ticked, and display a message if...
0
1418
by: Rick | last post by:
VS 2005 I have some custom business objects (BindingList(of T)) connected through BindingSources to a BindingNavigator. When the user moves focus the BindingSource of the navigator can be...
1
1424
by: Chetana | last post by:
Hi All, I want the query in sql which gives count of records for 2 conditions. Say i have table Category which has CategoryID and SubCatID as 2 columns. Then suppose i want count for the...
2
4004
by: narpet | last post by:
Hello all, I am trying to find out if it is possible to get a list of all of the event IDs that MS SQL server can generate. Does anyone know if a compiled list exists anywhere? Also, can this...
1
1516
by: Nellorekrishna | last post by:
Hi , Can anybody help in in finding count of value in a column. suppose test is a column and in it value are seperated by comma (''krishna","vijay",.......)
0
6974
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...
0
7183
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...
1
6852
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...
0
7356
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...
0
5448
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,...
0
3084
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...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
277
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...

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.