通过


ExternalException 构造函数

定义

初始化 ExternalException 类的新实例。

重载

名称 说明
ExternalException()

使用默认属性初始化类的新实例 ExternalException

ExternalException(String)

使用指定的错误消息初始化类的新实例 ExternalException

ExternalException(SerializationInfo, StreamingContext)
已过时.

从序列化数据初始化类的新实例 ExternalException

ExternalException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用初始化 ExternalException 类的新实例。

ExternalException(String, Int32)

使用指定的错误消息和错误的 HRESULT 初始化类的新实例 ExternalException

ExternalException()

Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs

使用默认属性初始化类的新实例 ExternalException

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

注解

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

财产 价值
InnerException Null 引用(Nothing 在 Visual Basic 中)。
Message 本地化的错误消息字符串。

适用于

ExternalException(String)

Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs

使用指定的错误消息初始化类的新实例 ExternalException

public:
 ExternalException(System::String ^ message);
public ExternalException(string? message);
public ExternalException(string message);
new System.Runtime.InteropServices.ExternalException : string -> System.Runtime.InteropServices.ExternalException
Public Sub New (message As String)

参数

message
String

指定异常原因的错误消息。

注解

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

财产 价值
InnerException Null 引用(Nothing 在 Visual Basic 中)。
Message 错误消息字符串。

适用于

ExternalException(SerializationInfo, StreamingContext)

Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs

注意

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

从序列化数据初始化类的新实例 ExternalException

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

参数

info
SerializationInfo

保存序列化对象数据的对象。

context
StreamingContext

有关源或目标的上下文信息。

属性

例外

infonull

注解

在反序列化期间调用此构造函数以重新构造通过流传输的异常对象。 有关详细信息,请参阅 XML 和 SOAP 序列化

适用于

ExternalException(String, Exception)

Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs

使用指定的错误消息和对作为此异常原因的内部异常的引用初始化 ExternalException 类的新实例。

public:
 ExternalException(System::String ^ message, Exception ^ inner);
public ExternalException(string? message, Exception? inner);
public ExternalException(string message, Exception inner);
new System.Runtime.InteropServices.ExternalException : string * Exception -> System.Runtime.InteropServices.ExternalException
Public Sub New (message As String, inner As Exception)

参数

message
String

说明异常原因的错误消息。

inner
Exception

是当前异常原因的异常。 如果未 innernull 参数,则会在处理内部异常的 catch 块中引发当前异常。

注解

作为上一个异常的直接结果引发的异常应包括对 InnerException 属性中上一个异常的引用。 InnerException 属性返回传入构造函数的相同值,或者如果 null 属性未向构造函数提供内部异常值,则返回 InnerException

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

财产 价值
InnerException 内部异常引用。
Message 错误消息字符串。

另请参阅

适用于

ExternalException(String, Int32)

Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs
Source:
ExternalException.cs

使用指定的错误消息和错误的 HRESULT 初始化类的新实例 ExternalException

public:
 ExternalException(System::String ^ message, int errorCode);
public ExternalException(string? message, int errorCode);
public ExternalException(string message, int errorCode);
new System.Runtime.InteropServices.ExternalException : string * int -> System.Runtime.InteropServices.ExternalException
Public Sub New (message As String, errorCode As Integer)

参数

message
String

指定异常原因的错误消息。

errorCode
Int32

错误的 HRESULT。

注解

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

财产 价值
ErrorCode 错误的 HRESULT。
InnerException Null 引用(Nothing 在 Visual Basic 中)。
Message 错误消息字符串。

适用于