共用方式為


IOException 建構函式

定義

初始化該類別的新實例 IOException 及其訊息字串。

多載

名稱 Description
IOException()

初始化一個新的類別實例 IOException ,其訊息字串設為空字串(“”),HRESULT 設為 COR_E_IO,內部例外設為空參考。

IOException(String)

初始化一個新的類別實例 IOException ,訊息字串設為 message,HRESULT 設為 COR_E_IO,內部例外設為 null

IOException(SerializationInfo, StreamingContext)
已淘汰.

初始化類別的新實例 IOException ,並依指定的序列化與上下文資訊。

IOException(String, Exception)

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

IOException(String, Int32)

初始化一個新的類別實例 IOException ,其訊息字串設定為 , message 且 HRESULT 由使用者定義。

IOException()

來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs

初始化一個新的類別實例 IOException ,其訊息字串設為空字串(“”),HRESULT 設為 COR_E_IO,內部例外設為空參考。

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

備註

建構子會將 Message 新實例的屬性初始化為系統提供的訊息,描述錯誤,例如「執行請求操作時發生 I/O 錯誤」。此訊息考量了當前系統文化。

另請參閱

適用於

IOException(String)

來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs

初始化一個新的類別實例 IOException ,訊息字串設為 message,HRESULT 設為 COR_E_IO,內部例外設為 null

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

參數

message
String

String A,描述錯誤。 內容 message 是為了讓人類理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

備註

建構子會用 message初始化Message新實例的屬性。

另請參閱

適用於

IOException(SerializationInfo, StreamingContext)

來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs

警告

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

初始化類別的新實例 IOException ,並依指定的序列化與上下文資訊。

protected:
 IOException(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 IOException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected IOException(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 System.IO.IOException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.IOException
new System.IO.IOException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IO.IOException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

用於序列化或反序列化物件的資料。

context
StreamingContext

物件的來源與目的地。

屬性

另請參閱

適用於

IOException(String, Exception)

來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs

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

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

參數

message
String

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

innerException
Exception

該例外即為當前例外的原因。 若 innerException 參數不 null為 ,則在處理內部異常的區塊中提出 catch 當前例外。

備註

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

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

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

欲了解更多關於內部例外的資訊,請參見 InnerException

另請參閱

適用於

IOException(String, Int32)

來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs
來源:
IOException.cs

初始化一個新的類別實例 IOException ,其訊息字串設定為 , message 且 HRESULT 由使用者定義。

public:
 IOException(System::String ^ message, int hresult);
public IOException(string message, int hresult);
public IOException(string? message, int hresult);
new System.IO.IOException : string * int -> System.IO.IOException
Public Sub New (message As String, hresult As Integer)

參數

message
String

String A,描述錯誤。 內容 message 是為了讓人類理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

hresult
Int32

一個整數,代表所發生的錯誤。

另請參閱

適用於