Share via


Delegate.Remove Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Shared Function Remove ( _
    source As Delegate, _
    value As Delegate _
) As Delegate
[SecuritySafeCriticalAttribute]
public static Delegate Remove(
    Delegate source,
    Delegate value
)

Parameters

  • source
    Type: System.Delegate
    The delegate from which to remove the invocation list of value.
  • value
    Type: System.Delegate
    The delegate that supplies the invocation list to remove from the invocation list of source.

Return Value

Type: System.Delegate
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. Returns source if value is nulla null reference (Nothing in Visual Basic) or if the invocation list of value is not found within the invocation list of 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.

Exceptions

Exception Condition
MemberAccessException

The caller does not have access to the method represented by the delegate (for example, if the method is private).

ArgumentException

The delegate types do not match.

MethodAccessException

Application code attempts to access this member late-bound, for example, by using the Type.InvokeMember method.

Remarks

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. If the invocation list of value occurs more than once in the invocation list of source, the last occurrence is removed.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.