如何从C#中获取enum的显示值?

时间:2018-05-18 14:19:50

标签: c# enums

我得到的枚举值如下:

location = Enum.GetName(typeof(Locations), (Locations)record.Friday);

这是我的枚举:

    public enum Locations
    {
        [Display(Name = "Unspecified")]
        Unspecified = 0,
        [Display(Name = "Sick Leave")]
        sick = 1,
        [Display(Name = "On Holiday")]
        hol = 2
    }

目前我正在回归而不是假期

0 个答案:

没有答案