ApplicationException 构造函数

定义

初始化 ApplicationException 类的新实例。

重载

ApplicationException()

初始化 ApplicationException 类的新实例。

ApplicationException(String)

用指定的错误消息初始化 ApplicationException 类的新实例。

ApplicationException(SerializationInfo, StreamingContext)
已过时.

用序列化数据初始化 ApplicationException 类的新实例。

ApplicationException(String, Exception)

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

ApplicationException()

Source:
ApplicationException.cs
Source:
ApplicationException.cs
Source:
ApplicationException.cs

初始化 ApplicationException 类的新实例。

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

注解

此构造函数将 Message 新实例的 属性初始化为系统提供的消息,该消息描述错误,例如“发生应用程序错误”。此消息考虑了当前系统区域性。

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

properties
InnerException 空引用(在 Visual Basic 中为 Nothing)。
Message 本地化的错误消息字符串。

适用于

ApplicationException(String)

Source:
ApplicationException.cs
Source:
ApplicationException.cs
Source:
ApplicationException.cs

用指定的错误消息初始化 ApplicationException 类的新实例。

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

参数

message
String

描述错误的消息。

注解

message 参数的内容应为人所理解。 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。

此消息会考虑当前系统区域性。

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

properties
InnerException 空引用(在 Visual Basic 中为 Nothing)。
Message 错误消息字符串。

适用于

ApplicationException(SerializationInfo, StreamingContext)

Source:
ApplicationException.cs
Source:
ApplicationException.cs
Source:
ApplicationException.cs

注意

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

用序列化数据初始化 ApplicationException 类的新实例。

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

参数

info
SerializationInfo

承载序列化对象数据的对象。

context
StreamingContext

关于来源和目标的上下文信息

属性

注解

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

另请参阅

适用于

ApplicationException(String, Exception)

Source:
ApplicationException.cs
Source:
ApplicationException.cs
Source:
ApplicationException.cs

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

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

参数

message
String

解释异常原因的错误消息。

innerException
Exception

导致当前异常的异常。 如果 innerException 参数不为空引用,则在处理内部异常的 catch 块中引发当前异常。

注解

message 参数的内容应为人所理解。 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。

因前一个异常而直接引发的异常应在 InnerException 属性中包含对前一个异常的引用。 InnerException属性将返回相同的值,如果传递到构造函数中,则为 null 引用InnerException属性不会提供给构造函数的内部异常值。

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

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

另请参阅

适用于