Delen via


Requires.Argument Method

Definition

Overloads

Argument(Boolean, String, ValidationInterpolatedStringHandler)

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, String)

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, ResourceManager, String)

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, String, Object)

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, String, Object[])

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, ResourceManager, String, Object)
Argument(Boolean, String, ResourceManager, String, Object[])

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, String, Object, Object)

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, ResourceManager, String, Object, Object)

Throws an ArgumentException if a condition does not evaluate to true.

Argument(Boolean, String, ValidationInterpolatedStringHandler)

Throws an ArgumentException if a condition does not evaluate to true.

[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, ref Microsoft.ValidationInterpolatedStringHandler message);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * ValidationInterpolatedStringHandler -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, ByRef message As ValidationInterpolatedStringHandler)

Parameters

condition
Boolean
parameterName
String
message
Microsoft.ValidationInterpolatedStringHandler
Attributes

Applies to

Argument(Boolean, String, String)

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::String ^ message);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, string? message);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * string -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, message As String)

Parameters

condition
Boolean
parameterName
String
message
String
Attributes

Applies to

Argument(Boolean, String, ResourceManager, String)

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::Resources::ResourceManager ^ resourceManager, System::String ^ resourceName);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, System.Resources.ResourceManager resourceManager, string resourceName);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * System.Resources.ResourceManager * string -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, resourceManager As ResourceManager, resourceName As String)

Parameters

condition
Boolean

The condition to check.

parameterName
String

The name of the parameter to blame in the exception, if thrown.

resourceManager
ResourceManager

The resource manager from which to retrieve the exception message. For example: Strings.ResourceManager.

resourceName
String

The name of the string resource to obtain for the exception message. For example: nameof(Strings.SomeError).

Attributes

Exceptions

Thrown if resourceManager is null.

Thrown if condition is false.

Remarks

This overload allows only loading a localized string in the error condition as an optimization in perf critical sections over the simpler to use Argument(Boolean, String, String) overload.

Applies to

Argument(Boolean, String, String, Object)

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::String ^ message, System::Object ^ arg1);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, string message, object? arg1);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * string * obj -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, message As String, arg1 As Object)

Parameters

condition
Boolean
parameterName
String
message
String
arg1
Object
Attributes

Applies to

Argument(Boolean, String, String, Object[])

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::String ^ message, ... cli::array <System::Object ^> ^ args);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, string message, params object?[] args);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * string * obj[] -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, message As String, ParamArray args As Object())

Parameters

condition
Boolean
parameterName
String
message
String
args
Object[]
Attributes

Applies to

Argument(Boolean, String, ResourceManager, String, Object)

public:
 static void Argument(bool condition, System::String ^ parameterName, System::Resources::ResourceManager ^ resourceManager, System::String ^ unformattedMessageResourceName, System::Object ^ arg1);
public static void Argument (bool condition, string? parameterName, System.Resources.ResourceManager resourceManager, string unformattedMessageResourceName, object? arg1);
static member Argument : bool * string * System.Resources.ResourceManager * string * obj -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, resourceManager As ResourceManager, unformattedMessageResourceName As String, arg1 As Object)

Parameters

condition
Boolean
parameterName
String
resourceManager
ResourceManager
unformattedMessageResourceName
String

The name of the string resource to obtain for the exception message. For example: nameof(Strings.SomeError).

arg1
Object

The first formatting argument.

Applies to

Argument(Boolean, String, ResourceManager, String, Object[])

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::Resources::ResourceManager ^ resourceManager, System::String ^ unformattedMessageResourceName, ... cli::array <System::Object ^> ^ args);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, System.Resources.ResourceManager resourceManager, string unformattedMessageResourceName, params object?[] args);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * System.Resources.ResourceManager * string * obj[] -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, resourceManager As ResourceManager, unformattedMessageResourceName As String, ParamArray args As Object())

Parameters

condition
Boolean

The condition to check.

parameterName
String

The name of the parameter to blame in the exception, if thrown.

resourceManager
ResourceManager

The resource manager from which to retrieve the exception message. For example: Strings.ResourceManager.

unformattedMessageResourceName
String

The name of the string resource to obtain for the exception message. For example: nameof(Strings.SomeError).

args
Object[]

The formatting arguments.

Attributes

Applies to

Argument(Boolean, String, String, Object, Object)

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::String ^ message, System::Object ^ arg1, System::Object ^ arg2);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, string message, object? arg1, object? arg2);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * string * obj * obj -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, message As String, arg1 As Object, arg2 As Object)

Parameters

condition
Boolean
parameterName
String
message
String
arg1
Object
arg2
Object
Attributes

Applies to

Argument(Boolean, String, ResourceManager, String, Object, Object)

Throws an ArgumentException if a condition does not evaluate to true.

public:
 static void Argument(bool condition, System::String ^ parameterName, System::Resources::ResourceManager ^ resourceManager, System::String ^ unformattedMessageResourceName, System::Object ^ arg1, System::Object ^ arg2);
[System.Diagnostics.DebuggerStepThrough]
public static void Argument (bool condition, string? parameterName, System.Resources.ResourceManager resourceManager, string unformattedMessageResourceName, object? arg1, object? arg2);
[<System.Diagnostics.DebuggerStepThrough>]
static member Argument : bool * string * System.Resources.ResourceManager * string * obj * obj -> unit
Public Shared Sub Argument (condition As Boolean, parameterName As String, resourceManager As ResourceManager, unformattedMessageResourceName As String, arg1 As Object, arg2 As Object)

Parameters

condition
Boolean

The condition to check.

parameterName
String

The name of the parameter to blame in the exception, if thrown.

resourceManager
ResourceManager

The resource manager from which to retrieve the exception message. For example: Strings.ResourceManager.

unformattedMessageResourceName
String

The name of the string resource to obtain for the exception message. For example: nameof(Strings.SomeError).

arg1
Object

The first formatting argument.

arg2
Object

The second formatting argument.

Attributes

Applies to