EventInfo.GetRemoveMethod 方法

定义

返回用于从事件源删除事件处理程序委托的方法。

重载

GetRemoveMethod(Boolean)

在派生类中重写时,检索用于删除事件方法的 MethodInfo 对象,指定是否返回非公共方法。

GetRemoveMethod()

返回用于从事件源删除事件处理程序委托的方法。

GetRemoveMethod(Boolean)

Source:
EventInfo.cs
Source:
EventInfo.cs
Source:
EventInfo.cs

在派生类中重写时,检索用于删除事件方法的 MethodInfo 对象,指定是否返回非公共方法。

C#
public abstract System.Reflection.MethodInfo? GetRemoveMethod (bool nonPublic);
C#
public abstract System.Reflection.MethodInfo GetRemoveMethod (bool nonPublic);

参数

nonPublic
Boolean

如果可以返回非公共方法,则为 true;否则为 false

返回

一个 MethodInfo 对象,表示用于从事件源删除事件处理程序委托的方法。

实现

例外

nonPublictrue,用于添加事件处理程序委托的方法为非公共方法,且调用方没有权限反映非公共方法。

示例

通常, 方法具有以下签名:

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

GetRemoveMethod()

Source:
EventInfo.cs
Source:
EventInfo.cs
Source:
EventInfo.cs

返回用于从事件源删除事件处理程序委托的方法。

C#
public System.Reflection.MethodInfo? GetRemoveMethod ();
C#
public System.Reflection.MethodInfo GetRemoveMethod ();

返回

一个 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