Condividi tramite


Throw.IfArgumentOutOfRange(Boolean, String, String) Method

Definition

Throws ArgumentOutOfRangeException with the given parameter name and optional message if the given Boolean value is true.

public static void IfArgumentOutOfRange (bool isInvalid, string paramName, string message = default);
static member IfArgumentOutOfRange : bool * string * string -> unit
Public Shared Sub IfArgumentOutOfRange (isInvalid As Boolean, paramName As String, Optional message As String = Nothing)

Parameters

isInvalid
Boolean

The flag to test. This method throws if it's true and does nothing if it's false.

paramName
String

The name of the parameter being validated. This is passed to the ArgumentOutOfRangeException constructor.

message
String

An optional error message to include in the ArgumentOutOfRangeException. The default message is "Argument out of range."

Applies to