EventInfo.EventHandlerType : Event « Reflection « C# / C Sharp






EventInfo.EventHandlerType

  

using System;
using System.Reflection;

public delegate void MyDelegate(int i);
public class MainClass 
{
    public event MyDelegate ev;

    public static void Main() 
    {
        Type delegateType = typeof(MainClass).GetEvent("ev").EventHandlerType;
        MethodInfo invoke = delegateType.GetMethod("Invoke");
        ParameterInfo[] pars = invoke.GetParameters();
        foreach (ParameterInfo p in pars) 
        {
            Console.WriteLine(p.ParameterType);
        }
    }
}

   
    
  








Related examples in the same category

1.Show Events
2.EventInfo Class discovers the attributes of an event and provides access to event metadata.
3.Use reflection to get the Elapsed event
4.Get event handler type
5.Returns the EventInfo object representing the specified public event.
6.Returns the EventInfo object representing the specified event, using the specified binding constraints.
7.Search for events that are declared or inherited by the current Type, using the specified binding constraints.
8.Returns all the public events that are declared or inherited by the current Type.