Int32Extensions Class
Provides extension methods for the type int.
public static class Int32Extensions
- Inheritance:
- object object
Methods
IsWithin(int, int, int)
Determines whether the two values are within a specified range.
public static bool IsWithin(this int left, int right, int difference)
Parameter | Type | Description |
---|---|---|
left | int | The value on the left side of the comparison. |
right | int | The value on the left side of the comparison. |
difference | int | The difference threshold. |
Returns
- bool:
true
if the two values within a specified range; otherwise,false
.
Range(int, int, int)
Returns the specified value constrained to the specified minimum and maximum values.
public static int Range(this int value, int minValue, int maxValue)
Parameter | Type | Description |
---|---|---|
value | int | The value to constrain. |
minValue | int | The minimum value. |
maxValue | int | The maximum value. |
Returns
- int:
The specified value constrained to the specified minimum and maximum values.