TargetException 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 TargetException 类的新实例。
重载
| 名称 | 说明 |
|---|---|
| TargetException() |
使用空消息和异常的根本原因初始化类的新实例 TargetException 。 |
| TargetException(String) |
使用给定的消息和根本原因异常初始化类的新实例 TargetException 。 |
| TargetException(SerializationInfo, StreamingContext) |
已过时.
使用指定的序列化和上下文信息初始化类的新实例 TargetException 。 |
| TargetException(String, Exception) |
使用指定的错误消息和对作为此异常原因的内部异常的引用初始化类的新实例 TargetException 。 |
TargetException()
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
使用空消息和异常的根本原因初始化类的新实例 TargetException 。
public:
TargetException();
public TargetException();
Public Sub New ()
注解
该
TargetException继承自 .Exception 此构造函数设置对象的属性 Exception ,如下表所示。
| 财产 | 价值 |
|---|---|
| InnerException | null |
| Message | 空字符串(“)。 |
适用于
TargetException(String)
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
使用给定的消息和根本原因异常初始化类的新实例 TargetException 。
public:
TargetException(System::String ^ message);
public TargetException(string? message);
public TargetException(string message);
new System.Reflection.TargetException : string -> System.Reflection.TargetException
Public Sub New (message As String)
参数
- message
- String
描述 String 发生异常的原因。
注解
TargetException继承自 .Exception 此构造函数设置对象的属性 Exception ,如下表所示。
| 财产 | 价值 |
|---|---|
| InnerException | null |
| Message | message 字符串。 |
适用于
TargetException(SerializationInfo, StreamingContext)
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
注意
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
使用指定的序列化和上下文信息初始化类的新实例 TargetException 。
protected:
TargetException(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 TargetException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected TargetException(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.Reflection.TargetException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Reflection.TargetException
new System.Reflection.TargetException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Reflection.TargetException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
参数
- info
- SerializationInfo
用于序列化或反序列化对象的数据。
- context
- StreamingContext
对象的源和目标。
- 属性
适用于
TargetException(String, Exception)
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
- Source:
- TargetException.cs
使用指定的错误消息和对作为此异常原因的内部异常的引用初始化类的新实例 TargetException 。
public:
TargetException(System::String ^ message, Exception ^ inner);
public TargetException(string? message, Exception? inner);
public TargetException(string message, Exception inner);
new System.Reflection.TargetException : string * Exception -> System.Reflection.TargetException
Public Sub New (message As String, inner As Exception)
参数
- message
- String
说明异常原因的错误消息。
- inner
- Exception
是当前异常原因的异常。
inner如果参数不是null,则当前异常在处理内部异常的块中catch引发。
注解
作为上一个异常的直接结果引发的异常应包含对属性中上一异常的 InnerException 引用。 该 InnerException 属性返回传入构造函数的相同值,或者 null 该 InnerException 属性未向构造函数提供内部异常值。
下表显示了实例 TargetException的初始属性值。
| 财产 | 价值 |
|---|---|
| InnerException | 内部异常引用。 |
| Message | 错误消息字符串。 |