Click or drag to resize
CannotApplyEqualityOperatorAttribute Class
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.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    Slash.Diagnostics.ReSharper.AnnotationsCannotApplyEqualityOperatorAttribute

Namespace: Slash.Diagnostics.ReSharper.Annotations
Assembly: Slash.Diagnostics (in Slash.Diagnostics.dll) Version: 1.0.6018.40181
Syntax
public sealed class CannotApplyEqualityOperatorAttribute : Attribute

The CannotApplyEqualityOperatorAttribute type exposes the following members.

Constructors
  NameDescription
Public methodCannotApplyEqualityOperatorAttribute
Initializes a new instance of the CannotApplyEqualityOperatorAttribute class
Top
Examples
[CannotApplyEqualityOperator]
class NoEquality
{
}

class UsesNoEquality
{
  public void Test()
  {
    var ca1 = new NoEquality();
    var ca2 = new NoEquality();

    if (ca1 != null) // OK
    {
      bool condition = ca1 == ca2; // Warning
    }
  }
}
See Also