CannotApplyEqualityOperatorAttribute - класс

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.

Definition

Пространство имён: Tessa.Properties.Resharper
Сборка: Tessa (в Tessa.dll) Версия: 3.6.0.22
C#
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface|AttributeTargets.Struct, AllowMultiple = false, 
	Inherited = true)]
public sealed class CannotApplyEqualityOperatorAttribute : Attribute
Inheritance
Object    Attribute    CannotApplyEqualityOperatorAttribute

Пример

C#
[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
    }
  }
}

Конструкторы

CannotApplyEqualityOperatorAttributeИнициализирует новый экземпляр класса CannotApplyEqualityOperatorAttribute

Свойства

TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Унаследован от Attribute)

Методы

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(Унаследован от Attribute)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Унаследован от Object)
GetHashCodeReturns the hash code for this instance.
(Унаследован от Attribute)
GetTypeGets the Type of the current instance.
(Унаследован от Object)
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Унаследован от Attribute)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Унаследован от Attribute)
MemberwiseCloneCreates a shallow copy of the current Object.
(Унаследован от Object)
ToStringReturns a string that represents the current object.
(Унаследован от Object)

Методы расширения

Get
(Определяется ComHelper)
InternalMarkerCanvas Возвращает маркер аннотации
(Определяется AnnotationInternalsAccessor)
Invoke
(Определяется ComHelper)
Set
(Определяется ComHelper)

См. также