Aaltuj/VxFormGenerator

Leveraging Description Attribute in Enums

msaroka opened this issue · 2 comments

If an Enum uses the Description attribute could we control the text displayed in the dropdowns and multiple checkboxes?

Below is an example of what I mean.

public enum FuelType
{
    [Description("Bituminous Coal")] bit,
    [Description("Home Heating and Diesel Fuel (Distillate)")] dfo,
    [Description("Jet Fuel")] jf,
    [Description("Kerosene")] ker,
    [Description("Lignite Coal")] lig,
    [Description("Municipal Solid Waste")] msw,
    [Description("Natural Gas")] ng,
    [Description("Petroleum Coke")] pc,
    [Description("Propane Gas")] pg,
    [Description("Residual Fuel Oil")] rfo,
    [Description("Subbituminous Coal")] sub,
    [Description("Tire -Derived Fuel")] tdf,
    [Description("Waste Oil")] wo
}

This is supported by the display attribute.

public enum TypeOfForm
{
[Display(Name = "Simple datastructure")]
SIMPLE = 0,
[Display(Name = "Advanced datastructure")]
ADVANCED = 1,
[Display(Name = "Complex datastructure")]
COMPLEX = 2
}

Perfect. Thank you.