How to get the full signature of a delegate?

Discussion in 'ASP .Net Building Controls' started by, May 18, 2007.

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

    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"




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

    Evan Camilleri
, May 18, 2007
    1. Advertisements

  2. Kevin Spencer, May 18, 2007
    1. Advertisements

  3. On May 18, 11:27 am, "" <>

    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 Skeet [C# MVP], May 18, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.