Delegate.Remove(Delegate, Delegate) 方法

定义

从一个委托的调用列表中移除另一个委托的最后一个调用列表。Removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate.

public:
 static Delegate ^ Remove(Delegate ^ source, Delegate ^ value);
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 的调用列表。The delegate from which to remove the invocation list of value.

value
Delegate

委托,它提供将从其中移除 source 的调用列表的调用列表。The delegate that supplies the invocation list to remove from the invocation list of source.

返回

一个新委托,其调用列表的构成方法为:获取 source 的调用列表,如果在 value 的调用列表中找到了 value 的调用列表,则从中移除 source 的最后一个调用列表。A new delegate with an invocation list formed by taking the invocation list of source and removing the last occurrence of the invocation list of value, if the invocation list of value is found within the invocation list of source. 如果 sourcenull,或在 value 的调用列表中没有找到 value 的调用列表,则返回 sourceReturns source if value is null or if the invocation list of value is not found within the invocation list of source. 如果 value 的调用列表等于 source 的调用列表,或 source 为空引用,则返回空引用。Returns a null reference if the invocation list of value is equal to the invocation list of source or if source is a null reference.

异常

调用方不能访问由委托表示的方法(例如,在方法为私有方法的情况下)。The caller does not have access to the method represented by the delegate (for example, if the method is private).

委托类型不匹配。The delegate types do not match.

注解

如果的value调用列表与的调用source列表中的一组连续元素相匹配,则在的调用source列表value中将出现的调用列表。If the invocation list of value matches a contiguous set of elements in the invocation list of source, then the invocation list of value is said to occur within the invocation list of source. 如果的调用列表value在的调用source列表中出现多次,则将删除最后一个匹配项。If the invocation list of value occurs more than once in the invocation list of source, the last occurrence is removed.

安全性

ReflectionPermission
当通过诸如InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])等机制后期绑定调用时。when invoked late-bound through mechanisms such as InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]). 关联的枚举:MemberAccessAssociated enumeration: MemberAccess

适用于

另请参阅