Breyta

Deila með


ThreadStateException Constructors

Definition

Initializes a new instance of the ThreadStateException class.

Overloads

ThreadStateException()

Initializes a new instance of the ThreadStateException class with default properties.

ThreadStateException(String)

Initializes a new instance of the ThreadStateException class with a specified error message.

ThreadStateException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the ThreadStateException class with serialized data.

ThreadStateException(String, Exception)

Initializes a new instance of the ThreadStateException class with a specified error message and a reference to the inner exception that is the cause of this exception.

ThreadStateException()

Source:
ThreadStateException.cs
Source:
ThreadStateException.cs
Source:
ThreadStateException.cs

Initializes a new instance of the ThreadStateException class with default properties.

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

Remarks

This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "The requested operation cannot be performed on the thread due to its current state." This message takes into account the current system culture.

The following table shows the initial property values for an instance of ThreadStateException.

Property Value
InnerException null.
Message The localized error message string.

Applies to

ThreadStateException(String)

Source:
ThreadStateException.cs
Source:
ThreadStateException.cs
Source:
ThreadStateException.cs

Initializes a new instance of the ThreadStateException class with a specified error message.

public:
 ThreadStateException(System::String ^ message);
public ThreadStateException (string? message);
public ThreadStateException (string message);
new System.Threading.ThreadStateException : string -> System.Threading.ThreadStateException
Public Sub New (message As String)

Parameters

message
String

The error message that explains the reason for the exception.

Remarks

This constructor initializes the Message property of the new instance using the message parameter.

The following table shows the initial property values for an instance of ThreadStateException.

Property Value
InnerException null.
Message The error message string.

Applies to

ThreadStateException(SerializationInfo, StreamingContext)

Source:
ThreadStateException.cs
Source:
ThreadStateException.cs
Source:
ThreadStateException.cs

Caution

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Initializes a new instance of the ThreadStateException class with serialized data.

protected:
 ThreadStateException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ThreadStateException (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 ThreadStateException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Threading.ThreadStateException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Threading.ThreadStateException
[<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.Threading.ThreadStateException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Threading.ThreadStateException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

The SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

The StreamingContext that contains contextual information about the source or destination.

Attributes

Remarks

This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see XML and SOAP Serialization.

See also

Applies to

ThreadStateException(String, Exception)

Source:
ThreadStateException.cs
Source:
ThreadStateException.cs
Source:
ThreadStateException.cs

Initializes a new instance of the ThreadStateException class with a specified error message and a reference to the inner exception that is the cause of this exception.

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

Parameters

message
String

The error message that explains the reason for the exception.

innerException
Exception

The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in a catch block that handles the inner exception.

Remarks

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. 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.

The following table shows the initial property values for an instance of ThreadStateException.

Property Value
InnerException The inner exception reference.
Message The error message string.

See also

Applies to