Machinations

CannotApplyEqualityOperatorAttribute Class Reference

Indicates that the value of the marked type (or its derivatives) cannot be compared using '==' or '!=' operators and `Equals()` should be used instead. However, using '==' or '!=' for comparison with `null` is always permitted. More...

Inheritance diagram for CannotApplyEqualityOperatorAttribute:

## Detailed Description

Indicates that the value of the marked type (or its derivatives) cannot be compared using '==' or '!=' operators and `Equals()` should be used instead. However, using '==' or '!=' for comparison with `null` is always permitted.

[CannotApplyEqualityOperator]
class NoEquality { }
class UsesNoEquality {
void Test() {
var ca1 = new NoEquality();
var ca2 = new NoEquality();
if (ca1 != null) { // OK
bool condition = ca1 == ca2; // Warning
}
}
}

The documentation for this class was generated from the following file:

- Properties/Annotations.cs