IOException 构造函数

定义

使用其消息字符串初始化 IOException 类的新实例。

重载

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()

Source:
IOException.cs
Source:
IOException.cs
Source:
IOException.cs

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

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

注解

构造函数将 Message 新实例的 属性初始化为描述错误的系统提供的消息,例如“执行请求的操作时发生 I/O 错误”。此消息考虑了当前系统区域性。

另请参阅

适用于

IOException(String)

Source:
IOException.cs
Source:
IOException.cs
Source:
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

描述该错误的 Stringmessage 的内容设计为易于理解。 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。

注解

构造函数使用 message初始化Message新实例的 属性。

另请参阅

适用于

IOException(SerializationInfo, StreamingContext)

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

参数

info
SerializationInfo

用于串行化或反序列化对象的数据。

context
StreamingContext

对象的源和目标。

属性

另请参阅

适用于

IOException(String, Exception)

Source:
IOException.cs
Source:
IOException.cs
Source:
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 属性将返回传递给构造函数的同一值;如果 InnerException 属性不向构造函数提供内部异常值,则返回 null

下表显示了 IOException 实例的初始属性值。

properties “值”
InnerException 内部异常引用。
Message 错误消息字符串。

有关内部异常的详细信息,请参阅 InnerException

另请参阅

适用于

IOException(String, Int32)

Source:
IOException.cs
Source:
IOException.cs
Source:
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

描述该错误的 Stringmessage 的内容设计为易于理解。 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。

hresult
Int32

一个整数,用于标识已发生的错误。

另请参阅

适用于