Table of Contents

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

T

The type of the object that implements the IComparable<T> interface.

Inheritance
object
ComparableValueObject<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

value T

The 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

left ComparableValueObject<T>

The value to compare with right.

right ComparableValueObject<T>

The value to compare with left.

Returns

bool

true if left> is greater than right>; 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

left ComparableValueObject<T>

The value to compare with right.

right ComparableValueObject<T>

The value to compare with left.

Returns

bool

true if left> is greater than or equal to right>; 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

left ComparableValueObject<T>

The value to compare with right.

right ComparableValueObject<T>

The value to compare with left.

Returns

bool

true if left> is less than right>; 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

left ComparableValueObject<T>

The value to compare with right.

right ComparableValueObject<T>

The value to compare with left.

Returns

bool

true if left> is less than or equal to right>; otherwise, false.