ArgumentLongBetweenGuard.

ThrowIfIsBetween(long, long, long, string) Method

Summary

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

Syntax

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

Examples

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

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

Parameters

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

Return Value

Type Description
long
GitHub