473,394 Members | 1,769 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,394 software developers and data experts.

How to get the full signature of a delegate?

I need to get the full signature of a delagate in a string. Is this
possible?

In a control I have:

public delegate void Button_Click(object sender, EventArgs e);

public event Button_Click click;

then I have:

private void GetControlEvents(Control cControl)

{

EventInfo[] eventlist = cControl.GetType().GetEvents();

foreach(EventInfo eventlst in eventlist)

{

string st = eventlst.EventHandlerType.Name

}

}

In the above, variable st will have "Button_Click"

----------------------------

WHAT I NEED

----------------------------

I need to get in a string "void Button_Click(object sender, EventArgs e)"

Evan Camilleri
May 18 '07 #1
2 1158
The following MSDN article may be of help:

http://msdn2.microsoft.com/en-us/library/ms228976.aspx

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"news.microsoft.com" <ev**@holisticrd.com.nospamwrote in message
news:uG**************@TK2MSFTNGP04.phx.gbl...
>I need to get the full signature of a delagate in a string. Is this
possible?

In a control I have:

public delegate void Button_Click(object sender, EventArgs e);

public event Button_Click click;

then I have:

private void GetControlEvents(Control cControl)

{

EventInfo[] eventlist = cControl.GetType().GetEvents();

foreach(EventInfo eventlst in eventlist)

{

string st = eventlst.EventHandlerType.Name

}

}

In the above, variable st will have "Button_Click"

----------------------------

WHAT I NEED

----------------------------

I need to get in a string "void Button_Click(object sender, EventArgs e)"

Evan Camilleri


May 18 '07 #2
On May 18, 11:27 am, "news.microsoft.com" <e...@holisticrd.com.nospam>
wrote:

<snip>
I need to get in a string "void Button_Click(object sender, EventArgs e)"
As shown in the docs for EventInfo.EventHandlerType, if you get the
Invoke method of the delegate type, you can retrieve the parameter
types and return type from that.

Jon

May 18 '07 #3

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

Similar topics

1
by: vishakha.ganjoo | last post by:
' C Sharp function - Start ' private void id_ok_Click(object sender, EventArgs e) '{ ' try ' { ' _job = new OsaScanJob((OsaSessionState)Session); ' _job.Create(); ' _job.Completed += new...
1
by: mark4asp | last post by:
In Amit Kalani's book (0789728222, 70-315 exam prep. book) he says that: "a delegate is a special class whose object is capable of storing references to methods with a particular prototype" ...
3
by: # Cyrille37 # | last post by:
Hello, I come here to expose my use of delegate. I hope there is a better fashion, because in that form, parameters could not be verified at compilation time. <code> delegate void...
1
by: Anil Gupte | last post by:
I created a button dynamically and added an event hander as follows: AddHandler newbtnPick.Click, AddressOf newbtnPick_Click Private Sub newbtnPick_Click() End Sub I get an error: Method...
6
by: John B | last post by:
What is the reasoning for recommending that all events have the signature EventHandler(object sender, EventArgs e). Obviously I can create a custom delegate delegate void FooHandler(string foo)...
3
by: chance | last post by:
I want my thread method to return a String. However, the compiler is saying that the best overloaded method match for System.Threading.Thread has some invalid arguments. Not sure what I need to...
2
by: news.microsoft.com | last post by:
I need to get the full signature of a delagate in a string. Is this possible? In a control I have: public delegate void Button_Click(object sender, EventArgs e); public event Button_Click...
2
by: Bob Johnson | last post by:
It appears to me that the only things that differentiates any delegates is (1) the type name, and (2) the signature (return type or void, and parameters). Is this true? Take, for instance, the...
2
by: Brian J | last post by:
Please can anyone help a delegate newbie. I am 'upgrading' some VB6 code ... 'UPGRADE_WARNING: Add a delegate for AddressOf MidiIN_Proc midiError = midiInOpen(hMidiIN, mMPU401IN, AddressOf...
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:
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...

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.