EventInfo.GetRemoveMethod 方法
本文内容
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回用于从事件源删除事件处理程序委托的方法。
GetRemoveMethod(Boolean) |
在派生类中重写时,检索用于删除事件方法的 |
GetRemoveMethod() |
返回用于从事件源删除事件处理程序委托的方法。 |
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
在派生类中重写时,检索用于删除事件方法的 MethodInfo
对象,指定是否返回非公共方法。
public:
abstract System::Reflection::MethodInfo ^ GetRemoveMethod(bool nonPublic);
C#
public abstract System.Reflection.MethodInfo? GetRemoveMethod (bool nonPublic);
C#
public abstract System.Reflection.MethodInfo GetRemoveMethod (bool nonPublic);
abstract member GetRemoveMethod : bool -> System.Reflection.MethodInfo
Public MustOverride Function GetRemoveMethod (nonPublic As Boolean) As MethodInfo
参数
- nonPublic
- Boolean
如果可以返回非公共方法,则为 true
;否则为 false
。
返回
一个 MethodInfo 对象,表示用于从事件源删除事件处理程序委托的方法。
实现
例外
nonPublic
为 true
,用于添加事件处理程序委托的方法为非公共方法,且调用方没有权限反映非公共方法。
示例
通常, 方法具有以下签名:
remove_<EventName>(<EventHandlerType> handler)
另请参阅
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.5, 1.6, 2.0, 2.1 |
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
- Source:
- EventInfo.cs
返回用于从事件源删除事件处理程序委托的方法。
public:
System::Reflection::MethodInfo ^ GetRemoveMethod();
public:
virtual System::Reflection::MethodInfo ^ GetRemoveMethod();
C#
public System.Reflection.MethodInfo? GetRemoveMethod ();
C#
public System.Reflection.MethodInfo GetRemoveMethod ();
member this.GetRemoveMethod : unit -> System.Reflection.MethodInfo
abstract member GetRemoveMethod : unit -> System.Reflection.MethodInfo
override this.GetRemoveMethod : unit -> System.Reflection.MethodInfo
Public Function GetRemoveMethod () As MethodInfo
返回
一个 MethodInfo 对象,表示用于从事件源删除事件处理程序委托的方法。
实现
示例
通常, 方法具有以下签名:
remove_<EventName>(<EventHandlerType> handler)
另请参阅
适用于
.NET 9 和其他版本
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.5, 1.6, 2.0, 2.1 |