Bewerken

Delen via


InvalidEnumArgumentException Constructors

Definition

Initializes a new instance of the InvalidEnumArgumentException class.

Overloads

InvalidEnumArgumentException()

Initializes a new instance of the InvalidEnumArgumentException class without a message.

InvalidEnumArgumentException(String)

Initializes a new instance of the InvalidEnumArgumentException class with the specified message.

InvalidEnumArgumentException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the InvalidEnumArgumentException class using the specified serialization data and context.

InvalidEnumArgumentException(String, Exception)

Initializes a new instance of the InvalidEnumArgumentException class with the specified detailed description and the specified exception.

InvalidEnumArgumentException(String, Int32, Type)

Initializes a new instance of the InvalidEnumArgumentException class with a message generated from the argument, the invalid value, and an enumeration class.

InvalidEnumArgumentException()

Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs

Initializes a new instance of the InvalidEnumArgumentException class without a message.

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

Applies to

InvalidEnumArgumentException(String)

Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs

Initializes a new instance of the InvalidEnumArgumentException class with the specified message.

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

Parameters

message
String

The message to display with this exception.

Applies to

InvalidEnumArgumentException(SerializationInfo, StreamingContext)

Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.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 InvalidEnumArgumentException class using the specified serialization data and context.

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

Parameters

info
SerializationInfo

The SerializationInfo to be used for deserialization.

context
StreamingContext

The destination to be used for deserialization.

Attributes

Applies to

InvalidEnumArgumentException(String, Exception)

Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs

Initializes a new instance of the InvalidEnumArgumentException class with the specified detailed description and the specified exception.

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

Parameters

message
String

A detailed description of the error.

innerException
Exception

A reference to the inner exception that is the cause of this exception.

Applies to

InvalidEnumArgumentException(String, Int32, Type)

Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs
Source:
InvalidEnumArgumentException.cs

Initializes a new instance of the InvalidEnumArgumentException class with a message generated from the argument, the invalid value, and an enumeration class.

public:
 InvalidEnumArgumentException(System::String ^ argumentName, int invalidValue, Type ^ enumClass);
public InvalidEnumArgumentException (string? argumentName, int invalidValue, Type enumClass);
public InvalidEnumArgumentException (string argumentName, int invalidValue, Type enumClass);
new System.ComponentModel.InvalidEnumArgumentException : string * int * Type -> System.ComponentModel.InvalidEnumArgumentException
Public Sub New (argumentName As String, invalidValue As Integer, enumClass As Type)

Parameters

argumentName
String

The name of the argument that caused the exception.

invalidValue
Int32

The value of the argument that failed.

enumClass
Type

A Type that represents the enumeration class with the valid values.

Remarks

This constructor will create a localized message saying that the argumentName parameter was invalid because the value passed in was invalid, and that the value should be one of the values in the enumeration class.

Applies to