TypeBuilder.GetEvent(String, BindingFlags) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回具有指定名称的事件。
public:
override System::Reflection::EventInfo ^ GetEvent(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo? GetEvent(string name, System.Reflection.BindingFlags bindingAttr);
public override System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr);
public override System.Reflection.EventInfo? GetEvent(string name, System.Reflection.BindingFlags bindingAttr);
[<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)>]
override this.GetEvent : string * System.Reflection.BindingFlags -> System.Reflection.EventInfo
override this.GetEvent : string * System.Reflection.BindingFlags -> System.Reflection.EventInfo
Public Overrides Function GetEvent (name As String, bindingAttr As BindingFlags) As EventInfo
参数
- name
- String
要搜索的事件的名称。
- bindingAttr
- BindingFlags
限制搜索的值的 BindingFlags 按位组合。
返回
一个 EventInfo 对象,表示此类型声明或继承的具有指定名称的事件,或者 null 如果没有匹配项。
- 属性
例外
此方法未针对不完整的类型实现。
注解
使用 Type.GetType 或使用 Assembly.GetType 所检索类型的反射来检索类型。