This documentation is archived and is not being maintained.

Delegate Inequality Operator

Determines whether the specified delegates are not equal.

[Visual Basic]
returnValue = Delegate.op_Inequality(d1, d2)
[C#]
public static bool operator !=(
 Delegate d1,
 Delegate d2
);
[C++]
public: static bool op_Inequality(
 Delegate* d1,
 Delegate* d2
);
[JScript]
returnValue = d1 != d2;

[Visual Basic] In Visual Basic, you can use the operators defined by a type, but you cannot define your own. You can use the Equals method instead of the Delegate inequality operator.

[JScript] In JScript, you can use the operators defined by a type, but you cannot define your own.

Arguments [Visual Basic, JScript]

d1
The first delegate to compare.
d2
The second delegate to compare.

Parameters [C#, C++]

d1
The first delegate to compare.
d2
The second delegate to compare.

Return Value

true if d1 is not equal to d2; otherwise, false.

Remarks

Two delegates are considered not equal if they have different methods, different targets, or different invocation lists.

The methods and targets are compared for equality as follows:

  • If the two methods being compared are both static and are the same method 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 on the same object, the methods are considered equal and the targets are also considered equal.
  • Otherwise, the methods are not considered to be equal and the targets are also not considered to be equal.

Two invocation lists are not equal if they have different sizes, if they are ordered differently, or if at least one element from one list represents a method or target that is different from that represented by its corresponding element in the other list.

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 | Equals

Show: