TypeAccessException 构造函数
定义
初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class.
重载
| TypeAccessException() |
使用说明错误的系统提供的消息初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with a system-supplied message that describes the error. |
| TypeAccessException(String) |
使用说明错误的指定消息初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with a specified message that describes the error. |
| TypeAccessException(SerializationInfo, StreamingContext) |
用序列化数据初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with serialized data. |
| TypeAccessException(String, Exception) |
使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
TypeAccessException()
使用说明错误的系统提供的消息初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with a system-supplied message that describes the error.
public:
TypeAccessException();
public TypeAccessException ();
Public Sub New ()
注解
此构造函数将 Message 新实例的属性初始化为系统提供的描述错误的消息,如 "尝试访问该类型失败"。This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "Attempt to access the type failed." 此消息将考虑当前系统区域性。This message takes the current system culture into account.
下表显示了 TypeAccessException 实例的初始属性值。The following table shows the initial property values for an instance of TypeAccessException.
| propertiesProperty | 值Value |
|---|---|
| InnerException | 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic). |
| Message | 本地化的错误消息字符串。The localized error message string. |
适用于
TypeAccessException(String)
使用说明错误的指定消息初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with a specified message that describes the error.
public:
TypeAccessException(System::String ^ message);
public TypeAccessException (string message);
public TypeAccessException (string? message);
new TypeAccessException : string -> TypeAccessException
Public Sub New (message As String)
参数
- message
- String
描述该异常的消息。The message that describes the exception. 此构造函数的调用方必须确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor must ensure that this string has been localized for the current system culture.
注解
下表显示了 TypeAccessException 实例的初始属性值。The following table shows the initial property values for an instance of TypeAccessException.
| propertiesProperty | 值Value |
|---|---|
| InnerException | 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic). |
| Message | message 中指定的错误消息字符串。The error message string specified in message. |
适用于
TypeAccessException(SerializationInfo, StreamingContext)
用序列化数据初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with serialized data.
protected:
TypeAccessException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected TypeAccessException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new TypeAccessException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> TypeAccessException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
参数
- info
- SerializationInfo
包含序列化数据的对象。The object that holds the serialized data.
- context
- StreamingContext
关于来源和目标的上下文信息The contextual information about the source or destination.
注解
在反序列化过程中调用此构造函数来重建通过流传输的异常对象。This constructor is called during deserialization to reconstitute the exception object that was transmitted over a stream. 有关详细信息,请参阅 XML 和 SOAP 序列化。For more information, see XML and SOAP Serialization.
适用于
TypeAccessException(String, Exception)
使用指定的错误消息和对作为此异常原因的内部异常的引用来初始化 TypeAccessException 类的新实例。Initializes a new instance of the TypeAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public:
TypeAccessException(System::String ^ message, Exception ^ inner);
public TypeAccessException (string message, Exception inner);
public TypeAccessException (string? message, Exception? inner);
new TypeAccessException : string * Exception -> TypeAccessException
Public Sub New (message As String, inner As Exception)
参数
- message
- String
描述该异常的消息。The message that describes the exception. 此构造函数的调用方必须确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor must ensure that this string has been localized for the current system culture.
- inner
- Exception
导致当前异常的异常。The exception that is the cause of the current exception. 如果 inner 参数不为 null,则当前异常将在处理内部异常的 catch 块中引发。If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.
注解
因前一个异常而直接引发的异常应在 InnerException 属性中包含对前一个异常的引用。An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. InnerException 属性将返回传递给构造函数的同一值;如果 InnerException 属性不向构造函数提供内部异常值,则返回 null。The InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.
下表显示了 TypeAccessException 实例的初始属性值。The following table shows the initial property values for an instance of TypeAccessException.
| propertiesProperty | 值Value |
|---|---|
| InnerException | 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic). |
| Message | message 中指定的错误消息字符串。The error message string specified in message. |