Partager via


Delegate.Equals Method

Determines whether the specified object and the current singlecast (uncombinable) delegate share the same target, method, and invocation list.

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

Syntax

[MethodImplAttribute]
public override bool Equals (
         Objectobj
)

Parameters

  • obj
    The object you want to compare with the current singlecast (uncombinable) delegate.

Return Value

true if the specified object and the current delegate have the same target, method, and invocation list; otherwise, false.

Remarks

This method applies only if the current delegate is singlecast (uncombinable).

Two delegates with the same methods, the same targets, and the same invocation lists are considered equal, even if they are not both multicast (combinable) or both singlecast (uncombinable).

The methods and targets are compared for equality as follows:

  • If the two methods being compared are both static and are the same method used on the same class, the methods are considered equal and the targets are also considered equal.
  • If the two methods being compared are instance methods and are the same method used on the same object, the methods are considered equal and the targets are also considered equal.
  • Otherwise, the methods are not considered equal and the targets are also not considered equal.

Two invocation lists are considered identical only if they have the same order as one another and the corresponding elements from the two lists represent the same method and target.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

Delegate Class
Delegate Members
System Namespace