ArgumentDecimalBetweenGuard.

ThrowIfIsBetween(decimal, decimal, decimal, string) Method

Summary

Throws an System.ArgumentOutOfRangeException exception if the argument is between compareValueStart and compareValueEnd.

Syntax

public static decimal ThrowIfIsBetween(this decimal argument, decimal compareValueStart, decimal compareValueEnd, string nameOfArgument)

Examples

Throws when the argument `decimalArgument` is between 5 and 10.

var localVar = decimalArgument.ThrowIfIsBetween(5, 10, nameof(intArgument));

Parameters

Name Type Description
argument decimal Argument value.
compareValueStart decimal Start range to compare.
compareValueEnd decimal End range to compare.
nameOfArgument string Name of the argument.

Return Value

Type Description
decimal
GitHub