Export (0) Print
Expand All

Delegate.Remove Method

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

[Visual Basic]
Public Shared Function Remove( _
   ByVal source As Delegate, _
   ByVal value As Delegate _
) As Delegate
[C#]
public static Delegate Remove(
 Delegate source,
 Delegate value
);
[C++]
public: static Delegate* Remove(
 Delegate* source,
 Delegate* value
);
[JScript]
public static function Remove(
   source : Delegate,
 value : Delegate
) : Delegate;

Parameters

source
The delegate from which to remove the invocation list of value.
value
The delegate that supplies the invocation list to remove from the invocation list of source.

Return Value

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.

-or-

source, if value is a null reference (Nothing in Visual Basic), or if the invocation list of value is not found within the invocation list of source.

-or-

A null reference (Nothing), if the invocation list of value is equal to the invocation list of source, or if source is a null reference (Nothing).

Exceptions

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

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.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

.NET Framework Security: 

See Also

Delegate Class | Delegate Members | System Namespace | RemoveAll | RemoveImpl | Equals

Show:
© 2014 Microsoft