Summary
Throws an
ArgumentOutOfRangeException exception if the argument is between
compareValueStart and compareValueEnd.
- Namespace
- oehen
.arguard .Between - Containing Type
- Argument
Int Between Guard
Syntax
public static int ThrowIfIsBetween(this int argument, int compareValueStart, int compareValueEnd, string nameOfArgument)
Examples
Throws when the argument `intArgument` is between 5 and 10.
var localVar = intArgument.ThrowIfIsBetween(5, 10, nameof(intArgument));
Parameters
| Name | Type | Description |
|---|---|---|
| argument | int | Argument value. |
| compareValueStart | int | Start range to compare. |
| compareValueEnd | int | End range to compare. |
| nameOfArgument | string | Name of the argument. |
Return Value
| Type | Description |
|---|---|
| int |