Getting attributes of Enum's value

后端 未结 25 2538
慢半拍i
慢半拍i 2020-11-22 00:35

I would like to know if it is possible to get attributes of the enum values and not of the enum itself? For example, suppose I have the following <

25条回答
  •  抹茶落季
    2020-11-22 01:04

    You can also define an enum value like Name_Without_Spaces, and when you want a description use Name_Without_Spaces.ToString().Replace('_', ' ') to replace the underscores with spaces.

提交回复
热议问题