T GreaterThan<T>(T);
T GreaterThanOrEqualTo<T>(T);
T LessThan<T>(T);
T LessThanOrEqualTo<T>(T);
Parameters
Parameter
Type
Description
other
T
The value to compare against.
Description
Determines if the current value is greater/less than (or equal to) another value.
Benefits
The IComparable<T> interface offers CompareTo(T) method, but naturally does not offer operators such as ><>= and <=. These methods would essentially implement that functionality.
Drawbacks
None considered (at this current time)
(Optional) Implementation example
{
return value.CompareTo(other) < 0;
// or
return value.CompareTo(other) <= 0;
// or
return value.CompareTo(other) > 0;
// or
return value.CompareTo(other) >= 0;
}
Type
Extension method signature
T
Description Determines if the current value is greater/less than (or equal to) another value.
Benefits The
IComparable<T>
interface offersCompareTo(T)
method, but naturally does not offer operators such as>
<
>=
and<=
. These methods would essentially implement that functionality.Drawbacks None considered (at this current time)
(Optional) Implementation example