Get Event Name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    Get Event Name

    I have the following function for firing various events. Is there a
    way to get the name of the event I am firing using only the info
    already provided to the function? I don’t want to add another
    parameter to the function and I don’t want to change the EventArgs
    parameter to something derived from EventArgs.

    static private void FireEventProces sing(object source, Delegate
    handler, EventArgs e)
    {
    if (handler != null)
    {
    handler.Dynamic Invoke(source, e);
    }
    }

    Thanks,
    Mike
  • Paul E Collins

    #2
    Re: Get Event Name

    "Mike" <MLM450@hotmail .comwrote:
    I have the following function for firing various events. Is there a way to
    get the name of the event I am firing using only the info already provided
    to the function?
    Only if you can determine it from the type of EventArgs (e.g. whether it's a
    KeyPressEventAr gs or whatever). That's possible only if all of your events
    happen to use different subclasses of EventArgs.

    Otherwise, no.

    Eq.


    Comment

    Working...