Requires.Argument 方法

定义

重载

Argument(Boolean, String, ValidationInterpolatedStringHandler)

ArgumentException如果条件的计算结果不为 true,则引发 。

Argument(Boolean, String, String)

ArgumentException如果条件的计算结果不为 true,则引发 。

Argument(Boolean, String, ResourceManager, String)

ArgumentException如果条件的计算结果不为 true,则引发 。

Argument(Boolean, String, String, Object)

ArgumentException如果条件的计算结果不为 true,则引发 。

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

ArgumentException如果条件的计算结果不为 true,则引发 。

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

ArgumentException如果条件的计算结果不为 true,则引发 。

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

ArgumentException如果条件的计算结果不为 true,则引发 。

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

ArgumentException如果条件的计算结果不为 true,则引发 。

Argument(Boolean, String, ValidationInterpolatedStringHandler)

ArgumentException如果条件的计算结果不为 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)

参数

condition
Boolean
parameterName
String
message
Microsoft.ValidationInterpolatedStringHandler
属性

适用于

Argument(Boolean, String, String)

ArgumentException如果条件的计算结果不为 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)

参数

condition
Boolean
parameterName
String
message
String
属性

适用于

Argument(Boolean, String, ResourceManager, String)

ArgumentException如果条件的计算结果不为 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)

参数

condition
Boolean

要检查的条件。

parameterName
String

在异常中追溯的参数的名称(如果引发)。

resourceManager
ResourceManager

要从中检索异常消息的资源管理器。 例如:Strings.ResourceManager

resourceName
String

要为异常消息获取的字符串资源的名称。 例如:nameof(Strings.SomeError)

属性

例外

如果 为 ,nullresourceManager引发。

如果 为 ,falsecondition引发。

注解

此重载仅允许将错误条件中的本地化字符串作为性能关键部分的优化加载到使用更简单 Argument(Boolean, String, String) 的重载。

适用于

Argument(Boolean, String, String, Object)

ArgumentException如果条件的计算结果不为 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)

参数

condition
Boolean
parameterName
String
message
String
arg1
Object
属性

适用于

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

ArgumentException如果条件的计算结果不为 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())

参数

condition
Boolean
parameterName
String
message
String
args
Object[]
属性

适用于

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)

参数

condition
Boolean
parameterName
String
resourceManager
ResourceManager
unformattedMessageResourceName
String

要为异常消息获取的字符串资源的名称。 例如:nameof(Strings.SomeError)

arg1
Object

第一个格式参数。

适用于

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

ArgumentException如果条件的计算结果不为 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())

参数

condition
Boolean

要检查的条件。

parameterName
String

在异常中追溯的参数的名称(如果引发)。

resourceManager
ResourceManager

要从中检索异常消息的资源管理器。 例如:Strings.ResourceManager

unformattedMessageResourceName
String

要为异常消息获取的字符串资源的名称。 例如:nameof(Strings.SomeError)

args
Object[]

格式参数。

属性

适用于

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

ArgumentException如果条件的计算结果不为 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)

参数

condition
Boolean
parameterName
String
message
String
arg1
Object
arg2
Object
属性

适用于

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

ArgumentException如果条件的计算结果不为 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)

参数

condition
Boolean

要检查的条件。

parameterName
String

在异常中追溯的参数的名称(如果引发)。

resourceManager
ResourceManager

要从中检索异常消息的资源管理器。 例如:Strings.ResourceManager

unformattedMessageResourceName
String

要为异常消息获取的字符串资源的名称。 例如:nameof(Strings.SomeError)

arg1
Object

第一个格式参数。

arg2
Object

第二个格式参数。

属性

适用于