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.DataEntryControls.WPFAssembly: RingSoft.DataEntryControls.WPF (in RingSoft.DataEntryControls.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 } } }