Class ComparableValueObject<T>
- Namespace
- Codebelt.SharedKernel
- Assembly
- Codebelt.SharedKernel.dll
Provides an implementation of SingleValueObject<T> tailored for handling a single value that implements the IComparable<T> interface.
public abstract record ComparableValueObject<T> : SingleValueObject<T>, IEquatable<ValueObject>, IEquatable<SingleValueObject<T>>, IComparisonOperators<ComparableValueObject<T>, ComparableValueObject<T>, bool>, IEqualityOperators<ComparableValueObject<T>, ComparableValueObject<T>, bool>, IEquatable<ComparableValueObject<T>> where T : IComparable<T>
Type Parameters
TThe type of the object that implements the IComparable<T> interface.
- Inheritance
-
objectComparableValueObject<T>
- Implements
- Derived
- Inherited Members
-
SingleValueObject<T>.ToString()SingleValueObject<T>.GetHashCode()SingleValueObject<T>.Equals(object)SingleValueObject<T>.Equals(ValueObject)SingleValueObject<T>.Equals(SingleValueObject<T>)SingleValueObject<T>.<Clone>$()SingleValueObject<T>.EqualityContract
Constructors
ComparableValueObject(T)
Initializes a new instance of the ComparableValueObject<T> class.
protected ComparableValueObject(T value)
Parameters
valueTThe value to associate to Value.
Operators
operator >(ComparableValueObject<T>, ComparableValueObject<T>)
Compares two values to determine which is greater.
public static bool operator >(ComparableValueObject<T> left, ComparableValueObject<T> right)
Parameters
leftComparableValueObject<T>The value to compare with
right.rightComparableValueObject<T>The value to compare with
left.
Returns
- bool
trueifleft> is greater thanright>; otherwise,false.
operator >=(ComparableValueObject<T>, ComparableValueObject<T>)
Compares two values to determine which is less or equal.
public static bool operator >=(ComparableValueObject<T> left, ComparableValueObject<T> right)
Parameters
leftComparableValueObject<T>The value to compare with
right.rightComparableValueObject<T>The value to compare with
left.
Returns
- bool
trueifleft> is greater than or equal toright>; otherwise,false.
operator <(ComparableValueObject<T>, ComparableValueObject<T>)
Compares two values to determine which is less.
public static bool operator <(ComparableValueObject<T> left, ComparableValueObject<T> right)
Parameters
leftComparableValueObject<T>The value to compare with
right.rightComparableValueObject<T>The value to compare with
left.
Returns
- bool
trueifleft> is less thanright>; otherwise,false.
operator <=(ComparableValueObject<T>, ComparableValueObject<T>)
Compares two values to determine which is less or equal.
public static bool operator <=(ComparableValueObject<T> left, ComparableValueObject<T> right)
Parameters
leftComparableValueObject<T>The value to compare with
right.rightComparableValueObject<T>The value to compare with
left.
Returns
- bool
trueifleft> is less than or equal toright>; otherwise,false.