ArgumentIntLessThanGuard.

ThrowIfIsLessThanZero(int, string) Method

Summary

Throws an System.ArgumentOutOfRangeException exception if the argument is less than 0.

Syntax

public static int ThrowIfIsLessThanZero(this int argument, string nameOfArgument)

Examples

Throws when the argument `intArgument` is less than 0.

var localVar = intArgument.ThrowIfIsLessThanZero(nameof(intArgument));

Parameters

Name Type Description
argument int Argument value.
nameOfArgument string Name of the argument.

Return Value

Type Description
int
GitHub