共用方式為


Requires.Argument 方法

定義

多載

Argument(Boolean, String, ValidationInterpolatedStringHandler)

如果條件未評估為 true,則會 ArgumentException 擲回 。

Argument(Boolean, String, String)

如果條件未評估為 true,則會 ArgumentException 擲回 。

Argument(Boolean, String, ResourceManager, String)

如果條件未評估為 true,則會 ArgumentException 擲回 。

Argument(Boolean, String, String, Object)

如果條件未評估為 true,則會 ArgumentException 擲回 。

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

如果條件未評估為 true,則會 ArgumentException 擲回 。

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

如果條件未評估為 true,則會 ArgumentException 擲回 。

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

如果條件未評估為 true,則會 ArgumentException 擲回 。

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

如果條件未評估為 true,則會 ArgumentException 擲回 。

Argument(Boolean, String, ValidationInterpolatedStringHandler)

如果條件未評估為 true,則會 ArgumentException 擲回 。

[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)

如果條件未評估為 true,則會 ArgumentException 擲回 。

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)

如果條件未評估為 true,則會 ArgumentException 擲回 。

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)

屬性

例外狀況

如果 resourceManagernull,則擲回 。

如果 conditionfalse,則擲回 。

備註

此多載只允許在錯誤狀況中載入當地語系化字串,做為效能關鍵區段中的優化,以更簡單的方式使用 Argument(Boolean, String, String) 多載。

適用於

Argument(Boolean, String, String, Object)

如果條件未評估為 true,則會 ArgumentException 擲回 。

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[])

如果條件未評估為 true,則會 ArgumentException 擲回 。

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[])

如果條件未評估為 true,則會 ArgumentException 擲回 。

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)

如果條件未評估為 true,則會 ArgumentException 擲回 。

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)

如果條件未評估為 true,則會 ArgumentException 擲回 。

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

第二個格式化自變數。

屬性

適用於