This documentation is archived and is not being maintained.

EventInfo.EventHandlerType Property

Gets the Type object of the underlying event-handler delegate associated with this event.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public Type EventHandlerType { get; }
/** @property */
public final Type get_EventHandlerType ()

public final function get EventHandlerType () : Type

Property Value

A read-only Type object representing the delegate event handler.

Exception typeCondition

SecurityException

The caller does not have the required permission.

// The following example uses instances of classes in 
// the System.Reflection namespace to discover an event argument type.
using System;
using System.Reflection;

public delegate void MyDelegate(int i);
public class MainClass 
{
    public event MyDelegate ev;
    public void Fire(int i) 
    {
        ev += new MyDelegate(this.Fire);
    }

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

  • ReflectionPermission  for returning properties that are not public. Associated enumeration: ReflectionPermissionFlag.TypeInformation

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Show: