ArgumentOutOfRangeException

The .NET exception to throw when an argument's value is outside what a method accepts, such as a negative price.

In more detail

Throwing it early, in a guard clause, stops a bad value travelling further into the program. Pass nameof(parameter) so the message names the argument, and the name stays right after a rename.

Related terms

Taught in

References