Share via


Requires.Defined<TEnum>(TEnum, String) Method

Definition

Throws an InvalidEnumArgumentException if a given value is not a named value of the enum type.

public:
generic <typename TEnum>
 where TEnum : value class static void Defined(TEnum value, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void Defined<TEnum> (TEnum value, string parameterName) where TEnum : struct;
[System.Diagnostics.DebuggerStepThrough]
public static void Defined<TEnum> (TEnum value, string? parameterName = default) where TEnum : struct;
[<System.Diagnostics.DebuggerStepThrough>]
static member Defined : 'Enum * string -> unit (requires 'Enum : struct)
Public Shared Sub Defined(Of TEnum As Structure) (value As TEnum, parameterName As String)
Public Shared Sub Defined(Of TEnum As Structure) (value As TEnum, Optional parameterName As String = Nothing)

Type Parameters

TEnum

The type of enum that may define the value.

Parameters

value
TEnum

The value that may be named by TEnum.

parameterName
String

The name of the parameter to include in any thrown exception. If this argument is omitted (explicitly writing null does not qualify), the expression used in the first argument will be used as the parameter name.

Attributes

Applies to