A static class that can be used to easily check input values of a method.
More...
|
| static TValue | CheckNotNull< TValue > (TValue value, String name=null) |
| | Checks if a value is null and throws an System.ArgumentNullException if it is. More...
|
| |
| static String | CheckNotNullOrEmpty (String value, String name=null) |
| | Checks if a String value is null or an empty string and raises an System.ArgumentException if it is. More...
|
| |
| static String | CheckNotNullOrWhiteSpace (String value, String name=null) |
| | Checks if a string argument is null or consists only out of invisible or white space characters. More...
|
| |
| static T | CheckRange< T > (T value, T min, T max, String name=null) |
| | Checks if an argument value is between an upper and lower bound. More...
|
| |
| static T | CheckUpperBound< T > (T value, T max, String name=null) |
| | Checks if an argument value is below an upper bound. More...
|
| |
| static T | CheckLowerBound< T > (T value, T min, String name=null) |
| | Checks if an argument value exceeds a lower bound. More...
|
| |
A static class that can be used to easily check input values of a method.
- Since
- 0.2.1
◆ CheckLowerBound< T >()
| static T Joutsen.System.Precondition.CheckLowerBound< T > |
( |
T |
value, |
|
|
T |
min, |
|
|
String |
name = null |
|
) |
| |
|
static |
Checks if an argument value exceeds a lower bound.
- Parameters
-
| value | the argument value to check |
| min | the lowest value that is allowed |
| name | the name of the argument that is tested |
- Returns
- the argument value if it is within the bound of min
- Exceptions
-
| ArgumentOutOfRangeException | if the argument value is not within the bound of min |
- Since
- 0.4.0
◆ CheckNotNull< TValue >()
| static TValue Joutsen.System.Precondition.CheckNotNull< TValue > |
( |
TValue |
value, |
|
|
String |
name = null |
|
) |
| |
|
static |
Checks if a value is null and throws an System.ArgumentNullException if it is.
- Parameters
-
| TValue | the type of the value that is checked |
| value | the value that is checked |
| name | optional, the name of the parameter that refers to the checked value |
- Returns
- the input
value if it is not null
- Exceptions
-
| System.ArgumentNullException | if value is null |
◆ CheckNotNullOrEmpty()
| static String Joutsen.System.Precondition.CheckNotNullOrEmpty |
( |
String |
value, |
|
|
String |
name = null |
|
) |
| |
|
static |
Checks if a String value is null or an empty string and raises an System.ArgumentException if it is.
- Parameters
-
| value | the value that is checked |
| name | optional, the name of the parameter that refers to the checked value |
- Returns
- the input
value if it is not null or an empty string
- Exceptions
-
| System.ArgumentNullException | if value is null |
| System.ArgumentException | if value is an empty string |
◆ CheckNotNullOrWhiteSpace()
| static String Joutsen.System.Precondition.CheckNotNullOrWhiteSpace |
( |
String |
value, |
|
|
String |
name = null |
|
) |
| |
|
static |
Checks if a string argument is null or consists only out of invisible or white space characters.
- Parameters
-
| value | the string to check |
| name | the name of the argument that is tested |
- Returns
- the string value if it does not only consist of white space characters or is null
- Exceptions
-
| ArgumentNullException | if the string is null |
| ArgumentException | if the string is empty or only contains of white space characters |
- Since
- 0.4.0
◆ CheckRange< T >()
| static T Joutsen.System.Precondition.CheckRange< T > |
( |
T |
value, |
|
|
T |
min, |
|
|
T |
max, |
|
|
String |
name = null |
|
) |
| |
|
static |
Checks if an argument value is between an upper and lower bound.
- Parameters
-
| value | the argument value to check |
| min | the lowest value that is allowed |
| max | the highest value that is allowed |
| name | the name of the argument that is tested |
- Returns
- the argument value if it is within the range of min and max
- Exceptions
-
| ArgumentOutOfRangeException | if the argument value is not within the range of min and max |
- Since
- 0.4.0
◆ CheckUpperBound< T >()
| static T Joutsen.System.Precondition.CheckUpperBound< T > |
( |
T |
value, |
|
|
T |
max, |
|
|
String |
name = null |
|
) |
| |
|
static |
Checks if an argument value is below an upper bound.
- Parameters
-
| value | the argument value to check |
| max | the highest value that is allowed |
| name | the name of the argument that is tested |
- Returns
- the argument value if it is within the bound of max
- Exceptions
-
| ArgumentOutOfRangeException | if the argument value is not within the bound of max |
- Since
- 0.4.0