Class IntegerExtensions
Namespace: GGL.Extensions
Assembly: GGL.dll
Syntax
public static class IntegerExtensions
Methods
| Edit this page View SourceAbs(int)
Returns the absolute value of value.
Declaration
public static int Abs(this int value)
Parameters
Type | Name | Description |
---|---|---|
int | value |
Returns
Type | Description |
---|---|
int |
Clamp(int, int)
Clamp(int, int, int) but min=0
Declaration
public static int Clamp(this int value, int max)
Parameters
Type | Name | Description |
---|---|---|
int | value | |
int | max |
Returns
Type | Description |
---|---|
int |
Clamp(int, int, int)
Clamps the given value between a range defined by the given minimum integer and maximum integer values. Returns the given value if it is within min and max.
Declaration
public static int Clamp(this int value, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
int | value | The integer point value to restrict inside the min-to-max range. |
int | min | The minimum integer point value to compare against. |
int | max | The maximum integer point value to compare against. |
Returns
Type | Description |
---|---|
int | The int result between min and max values. |
IsWithin(int, int, int)
Checks if value is within a range [a,b].
Declaration
public static bool IsWithin(this int value, int a, int b)
Parameters
Type | Name | Description |
---|---|---|
int | value | |
int | a | |
int | b |
Returns
Type | Description |
---|---|
bool |