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.DbLookup.Controls.WPF.PropertiesAssembly: RingSoft.DbLookup.Controls.WPF (in RingSoft.DbLookup.Controls.WPF.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 } } }