473,385 Members | 1,630 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.

Can I determine the delegate instance that was fired?

This may sound like a weird desire, but is there any way to get a reference
to the actual MulticastDelegate that was used to invoke a handler, from
within the handler? Maybe through the call stack or something?
Feb 28 '06 #1
2 1060
Peter Rilling <pe***@nospam.rilling.net> wrote:
This may sound like a weird desire, but is there any way to get a reference
to the actual MulticastDelegate that was used to invoke a handler, from
within the handler? Maybe through the call stack or something?


Not as far as I'm aware. Can I ask why you'd want to?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 28 '06 #2
Well, I am trying to think outside-the-box to try to implement an event
bubbling architecture that is a companion to my event broadcasting design
(http://www.codeproject.com/useritems...broadcast.asp).

I was first researching ways of getting the delegates from the actual event
but soon realized that the storage of the event can be anywhere and so I
cannot develop a consistent way of evaluating it. So I thought it would be
cool to grab the delegate after it had invoked some method thereby allowing
me to get the delegate no matter where it is stored.

Now the interesting thing is that to implement event bubbling, I only need
to know the number of delegates registered for an event, not necessarily the
actual delegates.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Peter Rilling <pe***@nospam.rilling.net> wrote:
This may sound like a weird desire, but is there any way to get a
reference
to the actual MulticastDelegate that was used to invoke a handler, from
within the handler? Maybe through the call stack or something?


Not as far as I'm aware. Can I ask why you'd want to?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Mar 2 '06 #3

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

Similar topics

18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
3
by: N8 | last post by:
I am trying to get an exception to occur and consequently found that when adding a target method to a delegates invocation list, a copy of that object is added instead of a reference to the object....
3
by: IMS.Rushikesh | last post by:
Hi All, There is a scenario, in which there is a counter in my base class. There is some initial value of this counter (check below code). Now there is a function "DecreaseCount", which will...
3
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
5
by: Doug Handler | last post by:
Hi, I have a form (Form1) that contains a tab control which one tab has a customer user control (UserControl1). When the user double-clicks on the grid hosted there a new user control is...
6
by: Bart Burkhardt | last post by:
Hi, I could use some help in setting a C# callback function that an external unmanaged dll will call on a event. Using a delegate and use the external callback set function doesn't work. The...
2
by: AboutJAV | last post by:
I created a mainmenu in the form class. I added the following code public delegate void ChangeMainMenuDelegate(bool bState); public void ChangeMainMenuState(bool bState) { for (int n = 0; n <...
3
by: Peter | last post by:
Hi I call some "worker"-Methods asyncronous. here some simplified code .... public delegate long AsyncWCaller(string parameter); ....
26
by: raylopez99 | last post by:
Here is a good example that shows generic delegate types. Read this through and you'll have an excellent understanding of how to use these types. You might say that the combination of the generic...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.