Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > How to get the full signature of a delegate?

Reply
Thread Tools

How to get the full signature of a delegate?

 
 
news.microsoft.com
Guest
Posts: n/a
 
      05-18-2007
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


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      05-18-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>



 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      05-18-2007
On May 18, 11:27 am, "news.microsoft.com" <(E-Mail Removed)>
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Turning a signature-changing decorator into a signature-preservingone Gustavo Narea Python 14 02-16-2009 04:58 PM
Re: XP Pro (Full) , X64 (Full) and Windows Server 2003 R2 TRIAL - which is latest ntldr ? - Bobb - Windows 64bit 9 12-14-2005 04:59 PM
Options for generic full-text search without using database-specific full-text engine? Samuel R. Neff ASP .Net 2 06-10-2005 06:53 PM
UTF-8 with signature & UTF-8 without signature JJBW ASP .Net 1 04-24-2004 10:21 AM



Advertisments