LocalizedEnumValue Class

Represents an enum value with its localized display name.

public sealed class LocalizedEnumValue

Constructors

NameDescription
LocalizedEnumValue(Enum)Initializes a new instance of the LocalizedEnumValue class using the enum value's string representation as the name.
LocalizedEnumValue(Enum, DisplayAttribute)Initializes a new instance of the LocalizedEnumValue class using a DisplayAttribute for localization.
LocalizedEnumValue(Enum, string)Initializes a new instance of the LocalizedEnumValue class with a custom name.

LocalizedEnumValue overloads

LocalizedEnumValue(Enum)

LocalizedEnumValue.cs

Initializes a new instance of the LocalizedEnumValue class using the enum value's string representation as the name.

public LocalizedEnumValue(Enum value)
Parameters
value Enum
The enum value.

LocalizedEnumValue(Enum, DisplayAttribute)

LocalizedEnumValue.cs

Initializes a new instance of the LocalizedEnumValue class using a DisplayAttribute for localization.

public LocalizedEnumValue(Enum value, DisplayAttribute displayAttribute)
Parameters
value Enum
The enum value.
displayAttribute DisplayAttribute
The display attribute containing localization information.

LocalizedEnumValue(Enum, string)

LocalizedEnumValue.cs

Initializes a new instance of the LocalizedEnumValue class with a custom name.

public LocalizedEnumValue(Enum value, string name)
Parameters
value Enum
The enum value.
name string
The display name.

Properties

NameDescription
NameGets the localized display name of the enum value.
ValueGets the enum value.

Gets the localized display name of the enum value.

public string Name { get; }

Property value

string

Gets the enum value.

public object Value { get; }

Property value

object

Methods

NameDescription
ToString()Returns the localized display name.

Returns the localized display name.

public override string ToString()

Returns

string