通过


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

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

注解

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

下表显示了实例 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

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

注解

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

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

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

另请参阅

适用于