Delegate.Remove(Delegate, Delegate) 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从一个委托的调用列表中移除另一个委托的最后一个调用列表。
public:
static Delegate ^ Remove(Delegate ^ source, Delegate ^ value);
C#
public static Delegate Remove(Delegate source, Delegate value);
C#
public static Delegate? Remove(Delegate? source, Delegate? value);
static member Remove : Delegate * Delegate -> Delegate
Public Shared Function Remove (source As Delegate, value As Delegate) As Delegate
- source
- Delegate
委托,将从中移除 value
的调用列表。
- value
- Delegate
委托,它提供将从其中移除 source
的调用列表的调用列表。
一个新委托,其调用列表的构成方法为:获取 source
的调用列表,如果在 value
的调用列表中找到了 value
的调用列表,则从中移除 source
的最后一个调用列表。 如果 source
为 null
,或在 value
的调用列表中没有找到 value
的调用列表,则返回 source
。 如果 value
的调用列表等于 source
的调用列表,或 source
为空引用,则返回空引用。
委托类型不匹配。
调用方不能访问由委托表示的方法(例如,在方法为私有方法的情况下)。
如果 的 value
调用列表与 的调用列表中的 source
一组连续的元素匹配,则 的调用列表 value
据说出现在 的 source
调用列表中。 如果 的调用列表 value
在 的调用列表中 source
多次出现,则删除最后一个匹配项。
产品 | 版本 |
---|---|
.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, 10 |
.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.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |