_Type.GetEvent 方法

定义

为 COM 对象提供对 GetEvent 方法的与版本无关的访问。

重载

GetEvent(String)

为 COM 对象提供对 GetEvent(String) 方法的与版本无关的访问。

GetEvent(String, BindingFlags)

为 COM 对象提供对 GetEvent(String, BindingFlags) 方法的与版本无关的访问。

注解

此方法用于从非托管代码访问托管类,不应从托管代码调用。

Type.GetEvent方法获取由当前声明或继承的特定事件 Type

GetEvent(String)

为 COM 对象提供对 GetEvent(String) 方法的与版本无关的访问。

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

参数

name
String

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。

  • 或 - 零,以返回 null

返回

EventInfo

EventInfo 对象的数组,表示当前 Type 所声明或继承的与指定绑定约束匹配的所有事件。

或 如果当前 EventInfo 没有事件,或者如果没有一个事件匹配绑定约束,则为 Type 类型的空数组。

注解

此方法用于从非托管代码访问托管类,不应从托管代码调用。

Type.GetEvent方法 Type 使用指定的绑定约束,搜索由当前声明或继承的事件。

适用于

GetEvent(String, BindingFlags)

为 COM 对象提供对 GetEvent(String, BindingFlags) 方法的与版本无关的访问。

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

参数

name
String

包含事件名称的 String,该事件是由当前 Type 声明或继承的。

bindingAttr
BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。

  • 或 - 零,以返回 null

返回

EventInfo

如找到,则为表示由当前 Type 声明或继承的指定事件的 EventInfo 对象;否则为 null

注解

此方法用于从非托管代码访问托管类,不应从托管代码调用。

Type.GetEvent方法 EventInfo 使用指定的绑定约束,返回表示指定事件的对象。

适用于