Mono Class Library: System.Type Overview | Members

System.Type.GetEvent Method

Returns a System.Reflection.EventInfo object reflecting the event that has the specified name, is defined in the type represented by the current instance, and matches the specified binding constraints.

public abstract System.Reflection.EventInfo GetEvent (string name, System.Reflection.BindingFlags bindingAttr)

Parameters

name
A string containing the name of the event to be returned.
bindingAttr
A bitwise combination of System.Reflection.BindingFlags values that control the binding process. If zero is specified, this method returns null.

Returns

A System.Reflection.EventInfo object reflecting the event that is named name, is defined in the type represented by the current instance, and matches the constraints of bindingAttr. If an event matching these criteria is not found, returns null. If the event is not public, the current instance represents a type from a loaded assembly, and the caller does not have sufficient permission, returns null.

If the current instance represents a generic type, this method returns the System.Reflection.EventInfo with the type parameters replaced by the appropriate type arguments.

Permissions

TypeReason
System.Security.Permissions.ReflectionPermissionRequires permission to retrieve information on non-public members of types in loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.TypeInformation.

Exceptions

TypeReason
ArgumentNullExceptionname is null.

Remarks

The following System.Reflection.BindingFlags are used to define which events to include in the search:

The following System.Reflection.BindingFlags value can be used to change how the search works:

Note: For more information, see System.Reflection.BindingFlags.

If the current instance represents an unassigned type parameter of a generic type or method, this method searches the events of the class constraint; the events of all interface constraints; and the events of any interfaces inherited from class or interface constraints.

Operation
As described above.

Requirements

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