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

参数

  • toRemove
    类型:System.Delegate
    要从委托中移除的回调方法。

返回值

类型:System.Delegate
要替换现有委托的新委托。如果 existing 为 nullnull 引用(在 Visual Basic 中为 Nothing),则返回 nullnull 引用(在 Visual Basic 中为 Nothing)。如果 toRemove 为 nullnull 引用(在 Visual Basic 中为 Nothing),则返回 existing。

备注

此方法知道如何对代理到泛型回调的委托进行解包。 如果创建该委托是为了代理一个泛型委托,则此方法将移除原始对象而非代理。

可以在 Unsubscribe 的实现中使用此方法。

.NET Framework 安全性

请参见

参考

ServiceManager 类

Microsoft.Windows.Design 命名空间

EditingContext

ContextItem

其他资源

WPF 设计器扩展性