可能重复:
获取枚举值的属性
这是我的课:
[AttributeUsage(AttributeTargets.Field)]
public sealed class LabelAttribute : Attribute
{
public LabelAttribute(String labelName)
{
Name = labelName;
}
public String Name { get; set; }
}
我想获取属性的字段:
public enum ECategory
{
[Label("Safe")]
Safe,
[Label("LetterDepositBox")]
LetterDepositBox,
[Label("SavingsBookBox")]
SavingsBookBox,
}