你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

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
System.Boolean

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

paramName
System.String

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

message
System.String

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

Applies to