Class IComparableTEx
Class containing some extension methods for System.IComparable`1.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class IComparableTEx
Methods
| Improve this Doc View SourceBetween<T>(T, T, T)
Checks if the given value is between (exclusive) the minValue and maxValue.
Declaration
public static bool Between<T>(this T value, T minValue, T maxValue)where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to check. |
T | minValue | The minimum value. |
T | maxValue | The maximum value. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the given value is between the minValue and maxValue, otherwise false. |
Type Parameters
Name | Description |
---|---|
T | The type of the values to compare. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The value can not be null. |
System.ArgumentNullException | The min value can not be null. |
System.ArgumentNullException | The max value can not be null. |
BetweenInclusive<T>(T, T, T)
Checks if the given value is between (inclusive) the minValue and maxValue.
Declaration
public static bool BetweenInclusive<T>(this T value, T minValue, T maxValue)where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to check. |
T | minValue | The minimum value. |
T | maxValue | The maximum value. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the given value is between the minValue and maxValue, otherwise false. |
Type Parameters
Name | Description |
---|---|
T | The type of the values to compare. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The value can not be null. |
System.ArgumentNullException | The min value can not be null. |
System.ArgumentNullException | The max value can not be null. |
Greater<T>(T, T)
Checks if the value is greater than the given compare value.
Declaration
public static bool Greater<T>(this T value, T compareValue)where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to check. |
T | compareValue | The value to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is greater than the given compare value, otherwise false. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The value can not be null. |
System.ArgumentNullException | The compare value can not be null. |
GreaterOrEquals<T>(T, T)
Checks if the value is greater or equals to the given compare value.
Declaration
public static bool GreaterOrEquals<T>(this T value, T compareValue)where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to check. |
T | compareValue | The value to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is greater or equals to the given compare value, otherwise false. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The value can not be null. |
System.ArgumentNullException | The compare value can not be null. |
Smaller<T>(T, T)
Checks if the value is smaller than the given compare value.
Declaration
public static bool Smaller<T>(this T value, T compareValue)where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to check. |
T | compareValue | The value to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is smaller than the given compare value, otherwise false. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The value can not be null. |
System.ArgumentNullException | The compare value can not be null. |
SmallerOrEquals<T>(T, T)
Checks if the value is smaller or equals to the given compare value.
Declaration
public static bool SmallerOrEquals<T>(this T value, T compareValue)where T : IComparable<T>
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to check. |
T | compareValue | The value to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is smaller or equals to the given compare value, otherwise false. |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The value can not be null. |
System.ArgumentNullException | The compare value can not be null. |