IOException IOException IOException IOException Constructors

定義

多載

IOException() IOException() IOException()

使用其訊息字串設定為空字串 ("")、其 HRESULT 設定為 COR_E_IO 和其內部例外狀況設定為 Null 參考,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with its message string set to the empty string (""), its HRESULT set to COR_E_IO, and its inner exception set to a null reference.

IOException(String) IOException(String) IOException(String) IOException(String)

使用其訊息字串設定為 message、其 HRESULT 設定為 COR_E_IO 和其內部例外狀況設定為 null,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with its message string set to message, its HRESULT set to COR_E_IO, and its inner exception set to null.

IOException(SerializationInfo, StreamingContext) IOException(SerializationInfo, StreamingContext) IOException(SerializationInfo, StreamingContext) IOException(SerializationInfo, StreamingContext)

使用指定的序列化 (Serialization) 和內容資訊,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with the specified serialization and context information.

IOException(String, Exception) IOException(String, Exception) IOException(String, Exception) IOException(String, Exception)

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with a specified error message and a reference to the inner exception that is the cause of this exception.

IOException(String, Int32) IOException(String, Int32) IOException(String, Int32) IOException(String, Int32)

使用其訊息字串設定為 message 和其使用者定義的 HRESULT,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with its message string set to message and its HRESULT user-defined.

IOException() IOException() IOException()

使用其訊息字串設定為空字串 ("")、其 HRESULT 設定為 COR_E_IO 和其內部例外狀況設定為 Null 參考,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with its message string set to the empty string (""), its HRESULT set to COR_E_IO, and its inner exception set to a null reference.

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

備註

此函式會Message將新實例的屬性初始化為描述錯誤的系統提供訊息, 例如「執行要求的作業時發生 i/o 錯誤」。The constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "An I/O error occurred while performing the requested operation." 此訊息會考量目前的系統文化特性。This message takes into account the current system culture.

另請參閱

IOException(String) IOException(String) IOException(String) IOException(String)

使用其訊息字串設定為 message、其 HRESULT 設定為 COR_E_IO 和其內部例外狀況設定為 null,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with its message string set to message, its HRESULT set to COR_E_IO, and its inner exception set to null.

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

參數

message
String String String String

描述錯誤的 StringA String that describes the error. message 的內容必須能讓人了解。The content of message is intended to be understood by humans. 這個建構函式的呼叫端必須確保這個字串已經被當地語系化 (為了目前系統的文化特性)。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

備註

此函式會Message使用message初始化新實例的屬性。The constructor initializes the Message property of the new instance using message.

另請參閱

IOException(SerializationInfo, StreamingContext) IOException(SerializationInfo, StreamingContext) IOException(SerializationInfo, StreamingContext) IOException(SerializationInfo, StreamingContext)

使用指定的序列化 (Serialization) 和內容資訊,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with the specified serialization and context information.

protected:
 IOException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected IOException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
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 SerializationInfo SerializationInfo SerializationInfo

用於序列化或還原序列化物件的資料。The data for serializing or deserializing the object.

context
StreamingContext StreamingContext StreamingContext StreamingContext

物件的來源和目的端。The source and destination for the object.

另請參閱

IOException(String, Exception) IOException(String, Exception) IOException(String, Exception) IOException(String, Exception)

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public:
 IOException(System::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 String String String

解釋例外狀況原因的錯誤訊息。The error message that explains the reason for the exception.

innerException
Exception Exception Exception Exception

做為目前例外狀況發生原因的例外狀況。The exception that is the cause of the current exception. 如果 innerException 參數不是 null,則目前的例外狀況會在處理內部例外的 catch 區塊中引發。If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

備註

被擲回以做為前一個例外狀況直接結果的例外狀況,應該在 InnerException 屬性中包含對前一個例外狀況的參考。An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. InnerException 屬性會傳回與傳入建構函式中相同的值;如果 null 屬性沒有提供內部例外值給建構函式,則傳回 InnerExceptionThe InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

下表顯示 IOException 執行個體的初始屬性值。The following table shows the initial property values for an instance of IOException.

屬性Property Value
InnerException 內部例外狀況參考。The inner exception reference.
Message 錯誤訊息字串。The error message string.

如需內部例外狀況的詳細資訊InnerException, 請參閱。For more information on inner exceptions, see InnerException.

另請參閱

IOException(String, Int32) IOException(String, Int32) IOException(String, Int32) IOException(String, Int32)

使用其訊息字串設定為 message 和其使用者定義的 HRESULT,初始化 IOException 類別的新執行個體。Initializes a new instance of the IOException class with its message string set to message and its HRESULT user-defined.

public:
 IOException(System::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 String String

描述錯誤的 StringA String that describes the error. message 的內容必須能讓人了解。The content of message is intended to be understood by humans. 這個建構函式的呼叫端必須確保這個字串已經被當地語系化 (為了目前系統的文化特性)。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

hresult
Int32 Int32 Int32 Int32

識別已發生錯誤的整數。An integer identifying the error that has occurred.

另請參閱

適用於