Class Equatable<T>
Provides a base implementation for objects that support equality, comparison, and cloning.
public abstract class Equatable<T> : Cloneable<T>, ICloneable<T>, ICloneable, IEquatable<T>, IComparable<T>, IComparable where T : class
Type Parameters
T
The type of the derived class.
- Inheritance
-
Cloneable<T>Equatable<T>
- Implements
-
ICloneable<T>IEquatable<T>IComparable<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
Equatable()
protected Equatable()
Methods
CompareTo(object)
Compares the current object with another object.
public int CompareTo(object value)
Parameters
value
objectAn object to compare with this object.
Returns
- int
0 if equal; -1 if not equal.
CompareTo(T)
Compares the current object with another object of the same type.
public virtual int CompareTo(T value)
Parameters
value
TAn object to compare with this object.
Returns
- int
0 if equal; -1 if not equal.
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with this object.
Returns
- bool
true if the specified object is equal to the current object; otherwise, false.
Equals(T)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(T other)
Parameters
other
TAn object to compare with this object.
Returns
- bool
true if the current object is equal to the other parameter; otherwise, false.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
OnEquals(T)
Determines equality between this instance and another instance of the same type.
protected virtual bool OnEquals(T other)
Parameters
other
TAn object to compare with this instance.
Returns
- bool
true if the objects are equal; otherwise, false.
Operators
operator ==(Equatable<T>, Equatable<T>)
Determines whether two Equatable objects are equal.
public static bool operator ==(Equatable<T> left, Equatable<T> right)
Parameters
Returns
- bool
true if the objects are equal; otherwise, false.
operator ==(Equatable<T>, T)
Determines whether an Equatable object and an object of type T are equal.
public static bool operator ==(Equatable<T> left, T right)
Parameters
left
Equatable<T>The Equatable object.
right
TThe object of type T.
Returns
- bool
true if the objects are equal; otherwise, false.
operator !=(Equatable<T>, Equatable<T>)
Determines whether two Equatable objects are not equal.
public static bool operator !=(Equatable<T> left, Equatable<T> right)
Parameters
Returns
- bool
true if the objects are not equal; otherwise, false.
operator !=(Equatable<T>, T)
Determines whether two Equatable objects are not equal.
public static bool operator !=(Equatable<T> left, T right)
Parameters
left
Equatable<T>The left Equatable object.
right
TThe right object of type T.
Returns
- bool
true if the objects are not equal; otherwise, false.