ServiceManager.RemoveCallback 方法
从委托中移除回调方法。
命名空间: Microsoft.Windows.Design
程序集: Microsoft.Windows.Design.Extensibility(在 Microsoft.Windows.Design.Extensibility.dll 中)
语法
声明
Protected Shared Function RemoveCallback ( _
existing As Delegate, _
toRemove As Delegate _
) As Delegate
protected static Delegate RemoveCallback(
Delegate existing,
Delegate toRemove
)
protected:
static Delegate^ RemoveCallback(
Delegate^ existing,
Delegate^ toRemove
)
static member RemoveCallback :
existing:Delegate *
toRemove:Delegate -> Delegate
protected static function RemoveCallback(
existing : Delegate,
toRemove : Delegate
) : Delegate
参数
- existing
类型:System.Delegate
要从中移除回调的委托。
- toRemove
类型:System.Delegate
要从委托中移除的回调方法。
返回值
类型:System.Delegate
要替换现有委托的新委托。如果 existing 为 nullnull 引用(在 Visual Basic 中为 Nothing),则返回 nullnull 引用(在 Visual Basic 中为 Nothing)。如果 toRemove 为 nullnull 引用(在 Visual Basic 中为 Nothing),则返回 existing。
备注
此方法知道如何对代理到泛型回调的委托进行解包。 如果创建该委托是为了代理一个泛型委托,则此方法将移除原始对象而非代理。
可以在 Unsubscribe 的实现中使用此方法。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。