IOException IOException IOException IOException Constructors

定义

重载

IOException() IOException() IOException()

初始化 IOException 类的新实例,其中将消息字符串设置为空字符串 (""),将其 HRESULT 设置为 COR_E_IO,并且将其内部异常设置为空引用。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)

初始化 IOException 类的新实例,其中将消息字符串设置为 message,将其 HRESULT 设置为 COR_E_IO,并且将其内部异常设置为 nullInitializes 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)

用指定的序列化和上下文信息初始化 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)

初始化 IOException 类的新实例,将其消息字符串设置为 message 并将其 HRESULT 设置为用户定义的。Initializes a new instance of the IOException class with its message string set to message and its HRESULT user-defined.

IOException() IOException() IOException()

初始化 IOException 类的新实例,其中将消息字符串设置为空字符串 (""),将其 HRESULT 设置为 COR_E_IO,并且将其内部异常设置为空引用。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)

初始化 IOException 类的新实例,其中将消息字符串设置为 message,将其 HRESULT 设置为 COR_E_IO,并且将其内部异常设置为 nullInitializes 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属性的新实例使用messageThe constructor initializes the Message property of the new instance using message.

另请参阅

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

用指定的序列化和上下文信息初始化 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.

PropertyProperty “值”Value
InnerException 内部异常引用。The inner exception reference.
Message 错误消息字符串。The error message string.

内部异常的详细信息,请参阅InnerExceptionFor more information on inner exceptions, see InnerException.

另请参阅

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

初始化 IOException 类的新实例,将其消息字符串设置为 message 并将其 HRESULT 设置为用户定义的。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.

另请参阅

适用于