共用方式為


ArgumentOutOfRangeException 建構函式

定義

初始化 ArgumentOutOfRangeException 類別的新執行個體。

多載

名稱 Description
ArgumentOutOfRangeException()

初始化 ArgumentOutOfRangeException 類別的新執行個體。

ArgumentOutOfRangeException(String)

初始化一個新的類別實例 ArgumentOutOfRangeException ,並以引起此例外的參數名稱。

ArgumentOutOfRangeException(SerializationInfo, StreamingContext)
已淘汰.

使用串行化數據,初始化 ArgumentOutOfRangeException 類別的新實例。

ArgumentOutOfRangeException(String, Exception)

初始化一個新的類別實例 ArgumentOutOfRangeException ,並以指定的錯誤訊息及導致該例外的例外。

ArgumentOutOfRangeException(String, String)

初始化一個新的類別實例 ArgumentOutOfRangeException ,並以引起此例外的參數名稱及指定的錯誤訊息。

ArgumentOutOfRangeException(String, Object, String)

初始化一個新的類別實例 ArgumentOutOfRangeException ,包含參數名稱、參數值及指定錯誤訊息。

ArgumentOutOfRangeException()

來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs

初始化 ArgumentOutOfRangeException 類別的新執行個體。

public:
 ArgumentOutOfRangeException();
public ArgumentOutOfRangeException();
Public Sub New ()

備註

此建構器會將 Message 新實例的屬性初始化為系統提供的訊息,描述錯誤,例如「需要非負數」。此訊息考量了當前系統文化。

下表顯示了 的 ArgumentOutOfRangeException初始屬性值。

房產 價值
InnerException 一個空參考(Nothing Visual Basic 中的 Reference)。
Message 區域化錯誤訊息字串。

適用於

ArgumentOutOfRangeException(String)

來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs

初始化一個新的類別實例 ArgumentOutOfRangeException ,並以引起此例外的參數名稱。

public:
 ArgumentOutOfRangeException(System::String ^ paramName);
public ArgumentOutOfRangeException(string paramName);
public ArgumentOutOfRangeException(string? paramName);
new ArgumentOutOfRangeException : string -> ArgumentOutOfRangeException
Public Sub New (paramName As String)

參數

paramName
String

造成此異常的參數名稱。

備註

此建構器會將 Message 新實例的屬性初始化為系統提供的訊息,描述錯誤,例如「需要非負數」。此訊息考量了當前系統文化。

此建構子會利用參數ParamName初始paramName化新實例的屬性。 內容 paramName 是為了讓人類理解。

下表顯示了 的 ArgumentOutOfRangeException初始屬性值。

房產 價值
InnerException 一個空參考(Nothing Visual Basic 中的 Reference)。
Message 空字串(“”)。
ParamName 參數名稱字串。

適用於

ArgumentOutOfRangeException(SerializationInfo, StreamingContext)

來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs

警告

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

使用串行化數據,初始化 ArgumentOutOfRangeException 類別的新實例。

protected:
 ArgumentOutOfRangeException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected ArgumentOutOfRangeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected ArgumentOutOfRangeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new ArgumentOutOfRangeException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> ArgumentOutOfRangeException
new ArgumentOutOfRangeException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> ArgumentOutOfRangeException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

存放序列化物件資料的物件。

context
StreamingContext

描述序列化資料來源或目的地的物件。

屬性

備註

此建構子在反序列化過程中被呼叫,以重建透過串流傳輸的例外物件。 欲了解更多資訊,請參閱 XML 與 SOAP 序列化

另請參閱

適用於

ArgumentOutOfRangeException(String, Exception)

來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs

初始化一個新的類別實例 ArgumentOutOfRangeException ,並以指定的錯誤訊息及導致該例外的例外。

public:
 ArgumentOutOfRangeException(System::String ^ message, Exception ^ innerException);
public ArgumentOutOfRangeException(string message, Exception innerException);
public ArgumentOutOfRangeException(string? message, Exception? innerException);
new ArgumentOutOfRangeException : string * Exception -> ArgumentOutOfRangeException
Public Sub New (message As String, innerException As Exception)

參數

message
String

錯誤訊息解釋了這個例外的原因。

innerException
Exception

該例外是當前例外的原因,或在 Visual Basic 中若未指定內部例外則為空參考Nothing

適用於

ArgumentOutOfRangeException(String, String)

來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs

初始化一個新的類別實例 ArgumentOutOfRangeException ,並以引起此例外的參數名稱及指定的錯誤訊息。

public:
 ArgumentOutOfRangeException(System::String ^ paramName, System::String ^ message);
public ArgumentOutOfRangeException(string paramName, string message);
public ArgumentOutOfRangeException(string? paramName, string? message);
new ArgumentOutOfRangeException : string * string -> ArgumentOutOfRangeException
Public Sub New (paramName As String, message As String)

參數

paramName
String

造成異常的參數名稱。

message
String

描述錯誤的訊息。

備註

此建構子會利用參數值Message初始message化新實例的屬性。 參數的內容 message 是為了讓人類理解而設計的。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

此建構子會利用參數ParamName初始paramName化新實例的屬性。 內容 paramName 是為了讓人類理解。

下表顯示了 的 ArgumentOutOfRangeException初始屬性值。

房產 價值
InnerException null
Message 錯誤訊息字串。
ParamName 參數名稱字串。

適用於

ArgumentOutOfRangeException(String, Object, String)

來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs
來源:
ArgumentOutOfRangeException.cs

初始化一個新的類別實例 ArgumentOutOfRangeException ,包含參數名稱、參數值及指定錯誤訊息。

public:
 ArgumentOutOfRangeException(System::String ^ paramName, System::Object ^ actualValue, System::String ^ message);
public ArgumentOutOfRangeException(string paramName, object actualValue, string message);
public ArgumentOutOfRangeException(string? paramName, object? actualValue, string? message);
new ArgumentOutOfRangeException : string * obj * string -> ArgumentOutOfRangeException
Public Sub New (paramName As String, actualValue As Object, message As String)

參數

paramName
String

造成異常的參數名稱。

actualValue
Object

造成此例外的參數值。

message
String

描述錯誤的訊息。

備註

此建構器會用paramName參數初始化新實例的屬性,ActualValue使用參數初始化屬性actualValue,再Message用參數初始ParamName化屬性message。 與message參數的內容paramName是為了讓人類理解。 此建構子的呼叫者必須確保這些字串已在目前系統文化中本地化。

actualValue 參數並未用於 .NET 類別函式庫中。 然而,應用程式可以利用該 ActualValue 屬性取得可用的參數值。

參數 actualValue 包含傳給方法的無效值,導致此例外被拋出。 這個值會儲存在屬性中 ActualValue ,其字串表示會附加在屬性中 Message 所保留的訊息字串上。

下表顯示了 的 ArgumentOutOfRangeException初始屬性值。

房產 價值
ActualValue 論證價值。
InnerException 空參考(Nothing Visual Basic 中的 Null reference)。
Message 錯誤訊息字串。
ParamName 參數名稱字串。

適用於