ProtocolException Constructors

Definition

Initializes a new instance of the ProtocolException class.

Overloads

ProtocolException()

Initializes a new instance of the ProtocolException class.

ProtocolException(String)

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

ProtocolException(SerializationInfo, StreamingContext)

Initializes a new instance of the ProtocolException class with serialization information and streaming context specified.

ProtocolException(String, Exception)

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

Remarks

If you want to pass an error message to the user, use the ProtocolException(String) constructor.

If you want to pass an error message and a reference to the inner exception that is the cause of the exception to the user, use the ProtocolException(String, Exception) constructor.

If you want to pass serialization information and streaming context, use the ProtocolException(SerializationInfo, StreamingContext) constructor.

ProtocolException()

Source:
ProtocolException.cs
Source:
ProtocolException.cs

Initializes a new instance of the ProtocolException class.

public ProtocolException ();

Applies to

.NET Framework 4.8.1 en andere versies
Product Versies
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ProtocolException(String)

Source:
ProtocolException.cs
Source:
ProtocolException.cs

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

public ProtocolException (string message);

Parameters

message
String

The error message that explains the reason for the exception.

Remarks

Use this constructor when you want to pass an error message to the user. The content of the message parameter should be understandable to the user. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

If you also want to pass a reference to the inner exception that is the cause of the exception as well as a specified error message to the user, use the ProtocolException(String, Exception) constructor.

Applies to

.NET 8 (package-provided) en andere versies
Product Versies
.NET Core 1.0, Core 1.1, 8 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

ProtocolException(SerializationInfo, StreamingContext)

Source:
ProtocolException.cs
Source:
ProtocolException.cs

Initializes a new instance of the ProtocolException class with serialization information and streaming context specified.

protected ProtocolException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);

Parameters

info
SerializationInfo

The SerializationInfo that contains all the data required to serialize the exception.

context
StreamingContext

The StreamingContext that specifies the source and destination of the stream.

Remarks

This constructor is called during deserialization to reconstruct the exception object transmitted over a stream.

Applies to

.NET 8 (package-provided) en andere versies
Product Versies
.NET 8 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

ProtocolException(String, Exception)

Source:
ProtocolException.cs
Source:
ProtocolException.cs

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

public ProtocolException (string message, Exception innerException);

Parameters

message
String

The error message that explains the reason for the exception.

innerException
Exception

The Exception that caused the current exception to be thrown.

Remarks

Use this constructor when you want to pass an error message and information about an inner exception up to the user. The content of the message parameter should be understandable to the intended users.

An exception that is thrown as a direct result of a previous exception can 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 a null reference (Nothing in Visual Basic) if the InnerException property does not supply the inner exception value to the constructor.

Applies to

.NET 8 (package-provided) en andere versies
Product Versies
.NET Core 1.0, Core 1.1, 8 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0