Class IComparableExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Provides extension methods for the IComparable and IComparable<T> interfaces.
public static class IComparableExtensions
- Inheritance
-
IComparableExtensions
- Inherited Members
Methods
AssignExtremum<T>(ref T, T, Extremum)
Assigns a variable storing a extremum value to other,
if found to be suitable as the new extremum.
public static void AssignExtremum<T>(this ref T extremum, T other, Extremum targetExtremum) where T : struct, IComparable<T>
Parameters
extremumTA reference to the variable storing the extremum. It may be overwritten if the comparison of
otheragainstextremummatches that oftargetExtremum.otherTThe other value to overwrite
extremumwith, if deemed as the new extremum.targetExtremumExtremumThe target extremum to match.
Type Parameters
TThe type of the values being compared.
AssignMax<T>(ref T, T)
Assigns a variable storing a maximum value to other,
if found to be greater than the current maximum.
public static void AssignMax<T>(this ref T max, T other) where T : struct, IComparable<T>
Parameters
maxTA reference to the variable storing the maximum. It may be overwritten if
otheris greater than the current maximum.otherTThe other value to overwrite
maxwith, if found to be greater than it.
Type Parameters
TThe type of the values being compared.
AssignMin<T>(ref T, T)
Assigns a variable storing a minimum value to other,
if found to be less than the current minimum.
public static void AssignMin<T>(this ref T min, T other) where T : struct, IComparable<T>
Parameters
minTA reference to the variable storing the minimum. It may be overwritten if
otheris less than the current minimum.otherTThe other value to overwrite
minwith, if found to be less than it.
Type Parameters
TThe type of the values being compared.
EqualTo(IComparable, object)
Determines whether value is equal to
other.
public static bool EqualTo(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
EqualTo<T>(IComparable<T>, T)
Determines whether value is equal to
other.
public static bool EqualTo<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
GetComparisonResult(IComparable, object)
Determines the result of the comparison of value with
other.
public static ComparisonResult GetComparisonResult(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
- ComparisonResult
A ComparisonResult representing the result of the comparison of
valuewithother.
GetComparisonResult<T>(IComparable<T>, T)
Determines the result of the comparison of value with
other.
public static ComparisonResult GetComparisonResult<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
- ComparisonResult
A ComparisonResult representing the result of the comparison of
valuewithother.
Type Parameters
TThe type of the value that
valuecan be compared with.
GreaterThan(IComparable, object)
Determines whether value is greater than
other.
public static bool GreaterThan(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
GreaterThanOrEqual(IComparable, object)
Determines whether value is greater than or equal to
other.
public static bool GreaterThanOrEqual(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
GreaterThanOrEqual<T>(IComparable<T>, T)
Determines whether value is greater than or equal to
other.
public static bool GreaterThanOrEqual<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
GreaterThan<T>(IComparable<T>, T)
Determines whether value is greater than
other.
public static bool GreaterThan<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
LessThan(IComparable, object)
Determines whether value is less than
other.
public static bool LessThan(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
LessThanOrEqual(IComparable, object)
Determines whether value is less than or equal to
other.
public static bool LessThanOrEqual(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
LessThanOrEqual<T>(IComparable<T>, T)
Determines whether value is less than or equal to
other.
public static bool LessThanOrEqual<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
LessThan<T>(IComparable<T>, T)
Determines whether value is less than
other.
public static bool LessThan<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
MatchesComparisonResult(IComparable, object, ComparisonResult)
Determines whether the comparison of value and
other matches the expected result.
public static bool MatchesComparisonResult(this IComparable value, object other, ComparisonResult result)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
resultComparisonResultThe expected comparison result.
Returns
MatchesComparisonResult<T>(IComparable<T>, T, ComparisonResult)
Determines whether the comparison of value and
other matches the expected result.
public static bool MatchesComparisonResult<T>(this IComparable<T> value, T other, ComparisonResult result)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
resultComparisonResultThe expected comparison result.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
NotEqualTo(IComparable, object)
Determines whether value is not equal to
other.
public static bool NotEqualTo(this IComparable value, object other)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
Returns
NotEqualTo<T>(IComparable<T>, T)
Determines whether value is not equal to
other.
public static bool NotEqualTo<T>(this IComparable<T> value, T other)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.
SatisfiesComparison(IComparable, object, ComparisonKinds)
Determines whether the comparison of value and
other satisfies the given comparison.
public static bool SatisfiesComparison(this IComparable value, object other, ComparisonKinds kinds)
Parameters
valueIComparableThe provided value to compare.
otherobjectThe other value to compare.
kindsComparisonKindsThe comparison kinds.
Returns
SatisfiesComparison<T>(IComparable<T>, T, ComparisonKinds)
Determines whether the comparison of value and
other satisfies the given comparison.
public static bool SatisfiesComparison<T>(this IComparable<T> value, T other, ComparisonKinds kinds)
Parameters
valueIComparable<T>The provided value to compare.
otherTThe other value to compare.
kindsComparisonKindsThe comparison kinds.
Returns
Type Parameters
TThe type of the value that
valuecan be compared with.