typescript Enumeration

class  Sex {
   static Male={
        Value:0,
        Label:'',
        Description:''
    }
    static FeMale={
        Value:1,
        Label:'',
        Description:''
    }
}
console.log(Sex.Male.Value);

It can be added as decoration on enumeration to obtain describe it as C #? This class may be temporarily replaced with an enumeration.

 

C # to write the following code can generate enumerated list:

public static List<KeyValuePair<Enum, string>> GetList(this Type T)
        {
            var result = new List<KeyValuePair<Enum, string>>();
            foreach (Enum item in Enum.GetValues(T))
            {
                result.Add(new KeyValuePair<Enum, string>(item, item.GetDescription()));
            }

            return result;
        }

It will generate something like: This is used to show the front of the drop-down list. As enumeration may be copying the front.

the this .statusEnumList = [ 
{ 
Key: 2 , 
value: ' Approval ' 
}, 
{ 
Key: . 4 , 
value: " spare parts in ' 
}]

 

Guess you like

Origin www.cnblogs.com/qgbo/p/11597537.html