RingSoft.DbLookup.Controls.WPF.Properties Namespace
RingSoft.DbMaintenance Namespace

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.

Namespace:  RingSoft.DbMaintenance
Assembly:  RingSoft.DbMaintenance (in RingSoft.DbMaintenance.dll)

Syntax


[AttributeUsageAttribute]
public sealed class CannotApplyEqualityOperatorAttribute : Attribute
<AttributeUsageAttribute> _
Public NotInheritable Class CannotApplyEqualityOperatorAttribute _
	Inherits Attribute
[AttributeUsageAttribute]
public ref class CannotApplyEqualityOperatorAttribute sealed : public Attribute

Examples


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

Inheritance Hierarchy


Object
  Attribute
    RingSoft.DbMaintenance..::..CannotApplyEqualityOperatorAttribute