EventInfo.GetAddMethod 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回用于向事件源添加事件处理程序委托的方法。
重载
| GetAddMethod() | 返回用于向事件源添加事件处理程序委托的方法。 | 
| GetAddMethod(Boolean) | 在派生类中重写时,为事件的 AddEventHandler(Object, Delegate) 方法检索  | 
GetAddMethod()
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
返回用于向事件源添加事件处理程序委托的方法。
public:
 System::Reflection::MethodInfo ^ GetAddMethod();public:
 virtual System::Reflection::MethodInfo ^ GetAddMethod();public System.Reflection.MethodInfo? GetAddMethod();public System.Reflection.MethodInfo GetAddMethod();member this.GetAddMethod : unit -> System.Reflection.MethodInfoabstract member GetAddMethod : unit -> System.Reflection.MethodInfo
override this.GetAddMethod : unit -> System.Reflection.MethodInfoPublic Function GetAddMethod () As MethodInfo返回
一个 MethodInfo 对象,表示用于向事件源添加事件处理程序委托的方法。
实现
示例
通常, 方法具有以下签名:
add_<EventName>(<EventHandlerType> handler)
注解
              GetAddMethod 初始化并添加事件订阅方法。 方法 AddEventHandler 用于将事件处理程序委托添加到事件源的调用列表中。
另请参阅
适用于
GetAddMethod(Boolean)
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
在派生类中重写时,为事件的 AddEventHandler(Object, Delegate) 方法检索 MethodInfo 对象,指定是否返回非公共方法。
public:
 abstract System::Reflection::MethodInfo ^ GetAddMethod(bool nonPublic);public abstract System.Reflection.MethodInfo? GetAddMethod(bool nonPublic);public abstract System.Reflection.MethodInfo GetAddMethod(bool nonPublic);abstract member GetAddMethod : bool -> System.Reflection.MethodInfoPublic MustOverride Function GetAddMethod (nonPublic As Boolean) As MethodInfo参数
- nonPublic
- Boolean
如果可以返回非公共方法,则为 true;否则为 false。
返回
一个 MethodInfo 对象,表示用于向事件源添加事件处理程序委托的方法。
实现
例外
              nonPublic 为 true,用于添加事件处理程序委托的方法为非公共方法,且调用方没有权限反映非公共方法。
示例
通常, 方法具有以下签名:
add_<EventName>(<EventHandlerType> handler)
注解
初始化 GetAddMethod 事件 subscribe 方法并将其添加为布尔值。 方法 AddEventHandler 用于将事件处理程序委托添加到事件源的调用列表中。