Mono Class Library: System.Reflection.EventInfo Overview | Members

System.Reflection.EventInfo.GetAddMethod Method

Returns the method used to add an event handler delegate to an event source for the event reflected by the current instance, specifying whether or not to return non-public methods.

public abstract MethodInfo GetAddMethod (bool nonPublic)

Parameters

nonPublic
A bool value that specifies whether non-public methods can be returned by this method. Specify true to return non-public methods; otherwise, specify false .

Returns

A System.Reflection.MethodInfo instance that reflects the method used to add an event handler delegate to an event source for the event reflected by the current instance, if found; otherwise, returns null .

Permissions

TypeReason
System.Security.Permissions.ReflectionPermissionRequires permission to reflect non-public members of a type in loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.TypeInformation.

Exceptions

TypeReason
MethodAccessExceptionnonPublic is true, the method used to add an event handler delegate is non-public, and the caller does not have permission to reflect on non-public methods.

Remarks

Note:

The returned method is used to add an event-handler delegate to the invocation list of an event source. Typically, the method has the following signature format:

add_<EventName>(<EventHandlerType> handler)

Operation
As described above.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0