Редактиране

Споделяне чрез


_Type.GetEvent Method

Definition

Provides COM objects with version-independent access to the GetEvent method.

Overloads

GetEvent(String)

Provides COM objects with version-independent access to the GetEvent(String) method.

GetEvent(String, BindingFlags)

Provides COM objects with version-independent access to the GetEvent(String, BindingFlags) method.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetEvent method gets a specific event declared or inherited by the current Type.

GetEvent(String)

Provides COM objects with version-independent access to the GetEvent(String) method.

public:
 System::Reflection::EventInfo ^ GetEvent(System::String ^ name);
public System.Reflection.EventInfo GetEvent (string name);
abstract member GetEvent : string -> System.Reflection.EventInfo
Public Function GetEvent (name As String) As EventInfo

Parameters

name
String

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

Returns

An array of EventInfo objects representing all events that are declared or inherited by the current Type that match the specified binding constraints.

-or-

An empty array of type EventInfo, if the current Type does not have events, or if none of the events match the binding constraints.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetEvent method searches for events that are declared or inherited by the current Type, using the specified binding constraints.

Applies to

GetEvent(String, BindingFlags)

Provides COM objects with version-independent access to the GetEvent(String, BindingFlags) method.

public:
 System::Reflection::EventInfo ^ GetEvent(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public System.Reflection.EventInfo GetEvent (string name, System.Reflection.BindingFlags bindingAttr);
abstract member GetEvent : string * System.Reflection.BindingFlags -> System.Reflection.EventInfo
Public Function GetEvent (name As String, bindingAttr As BindingFlags) As EventInfo

Parameters

name
String

The String containing the name of an event that is declared or inherited by the current Type.

bindingAttr
BindingFlags

A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or-

Zero, to return null.

Returns

The EventInfo object representing the specified event that is declared or inherited by the current Type, if found; otherwise, null.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The Type.GetEvent method returns the EventInfo object representing the specified event, using the specified binding constraints.

Applies to