TargetInvocationException 构造函数

定义

初始化 TargetInvocationException 类的新实例。

重载

名称 说明
TargetInvocationException(Exception)

使用对作为此异常原因的内部异常的引用初始化类的新实例 TargetInvocationException

TargetInvocationException(String, Exception)

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

TargetInvocationException(Exception)

Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs

使用对作为此异常原因的内部异常的引用初始化类的新实例 TargetInvocationException

public:
 TargetInvocationException(Exception ^ inner);
public TargetInvocationException(Exception inner);
public TargetInvocationException(Exception? inner);
new System.Reflection.TargetInvocationException : Exception -> System.Reflection.TargetInvocationException
Public Sub New (inner As Exception)

参数

inner
Exception

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

注解

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

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

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

另请参阅

适用于

TargetInvocationException(String, Exception)

Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs
Source:
TargetInvocationException.cs

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

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

参数

message
String

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

inner
Exception

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

注解

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

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

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

另请参阅

适用于