共用方式為


IndexOutOfRangeException 建構函式

定義

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

多載

名稱 Description
IndexOutOfRangeException()

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

IndexOutOfRangeException(String)

初始化類別的新實例 IndexOutOfRangeException 並指定錯誤訊息。

IndexOutOfRangeException(String, Exception)

初始化類別的新實例 IndexOutOfRangeException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

IndexOutOfRangeException()

來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs

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

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

備註

此建構子會將新實例的屬性初始 Message 化為系統提供的訊息,描述錯誤,例如「陣列索引超出範圍」。此訊息考量了當前系統文化。

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

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

適用於

IndexOutOfRangeException(String)

來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs

初始化類別的新實例 IndexOutOfRangeException 並指定錯誤訊息。

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

參數

message
String

描述錯誤的訊息。

備註

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

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

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

適用於

IndexOutOfRangeException(String, Exception)

來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs
來源:
IndexOutOfRangeException.cs

初始化類別的新實例 IndexOutOfRangeException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

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

參數

message
String

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

innerException
Exception

該例外即為當前例外的原因。 如果參數 innerException 不是 null 參考(Nothing 在 Visual Basic 中),當前例外會在處理內部例外的區塊中被提出 catch

備註

因先前例外直接拋出的例外,應包含對該屬性中 InnerException 先前例外的參考。 該InnerException屬性會回傳與傳入建構子相同的值,或若該InnerException屬性未提供內建器內部例外值,則回傳 Visual Basic 中的空參考Nothing

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

房產 價值
InnerException 內部例外的參考。
Message 錯誤訊息字串。

另請參閱

適用於