TimeoutException 构造函数

定义

初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class.

重载

TimeoutException()

初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class.

TimeoutException(String)

使用指定的错误消息初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class with the specified error message.

TimeoutException(SerializationInfo, StreamingContext)

用序列化数据初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class with serialized data.

TimeoutException(String, Exception)

使用指定的错误消息和内部异常初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class with the specified error message and inner exception.

TimeoutException()

初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class.

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

注解

此构造函数使用系统提供的错误消息初始化新实例的继承的 Exception.Message 属性。This constructor initializes the inherited Exception.Message property of the new instance with a system-supplied error message. 此消息将当前系统区域性考虑在内。This message takes into account the current system culture.

下表显示 TimeoutException 的实例的初始属性值。The following table shows the initial property values for an instance of TimeoutException.

PropertyProperty “值”Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 本地化的错误消息字符串。The localized error message string.

TimeoutException(String)

使用指定的错误消息初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class with the specified error message.

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

参数

message
String

描述错误的消息。The message that describes the error.

注解

此构造函数使用 message 参数的值初始化新实例的继承的 Exception.Message 属性。This constructor initializes the inherited Exception.Message property of the new instance using the value of the message parameter.

下表显示 TimeoutException 的实例的初始属性值。The following table shows the initial property values for an instance of TimeoutException.

PropertyProperty “值”Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 错误消息字符串。The error message string.

TimeoutException(SerializationInfo, StreamingContext)

用序列化数据初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class with serialized data.

protected:
 TimeoutException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected TimeoutException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new TimeoutException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> TimeoutException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

SerializationInfo 对象,它包含有关要引发的异常的序列化对象数据。The SerializationInfo object that contains serialized object data about the exception being thrown.

context
StreamingContext

StreamingContext 对象,它包含有关源或目标的上下文信息。The StreamingContext object that contains contextual information about the source or destination. context 参数保留供将来使用,并可以指定为 nullThe context parameter is reserved for future use, and can be specified as null.

例外

info 参数为 nullThe info parameter is null.

类名为 null 或者 HResult 为零 (0)。The class name is null, or HResult is zero (0).

注解

此构造函数在反序列化过程中调用,以便重建通过流传输的异常对象。This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. 有关详细信息,请参阅二进制序列化For more information, see Binary Serialization.

另请参阅

TimeoutException(String, Exception)

使用指定的错误消息和内部异常初始化 TimeoutException 类的新实例。Initializes a new instance of the TimeoutException class with the specified error message and inner exception.

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

参数

message
String

描述错误的消息。The message that describes the error.

innerException
Exception

导致当前异常的异常。The exception that is the cause of the current exception. 如果 innerException 参数不为 null,则当前异常将在处理内部异常的 catch 块中引发。If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

注解

此构造函数使用 message 参数的值初始化新实例的继承的 Exception.Message 属性。This constructor initializes the inherited Exception.Message property of the new instance using the value of the message parameter.

因前一个异常而直接引发的异常应在 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 属性不向构造函数提供内部异常值,则为 nullThe InnerException property returns the same value that is passed to the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

下表显示 TimeoutException 的实例的初始属性值。The following table shows the initial property values for an instance of TimeoutException.

PropertyProperty “值”Value
Message 错误消息字符串。The error message string.
InnerException 内部异常引用。The inner exception reference.

适用于