EnumBuilder.GetEvent(String, BindingFlags) 方法

定义

返回具有指定名称的事件。Returns the event with the specified name.

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

参数

name
String

要获取的事件的名称。The name of the event to get.

bindingAttr
BindingFlags

此调用属性。This invocation attribute. 这必须是来自 BindingFlags 的位标志:InvokeMethodNonPublic 等等。This must be a bit flag from BindingFlags : InvokeMethod, NonPublic, and so on.

返回

返回 EventInfo 对象,该对象表示此类型声明或继承的具有指定名称的事件。Returns an EventInfo object representing the event declared or inherited by this type with the specified name. 如果没有匹配项,则返回 nullIf there are no matches, null is returned.

例外

不完整类型目前不支持此方法。This method is not currently supported in types that are not complete.

注解

解决方法:若要检索已完成类型的事件,请使用 Type.GetTypeAssembly.GetType 检索该类型,并在检索的类型上使用反射。As a workaround, to retrieve the event of a finished type, retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.

适用于