C # 4.0
If I want to set a description for the listing, I can use the DescriptionAttribute System.ComponentModel;
public enum EnumWithDescription
{
[Description("EnumDescription1")]
EE = 1,
[Description("EnumDescription2")]
PP
}
but if I need another specific description, I can implement my special attribute and extension method, which will return this additional description. eg:
public enum EnumWithDescription
{
[MyDescritption("MyDescription1")]
[Description("EnumDescription1")]
EE = 1
}
anumValue.MyExtensionMethod();
Maybe there are some more simple ways to do this?
source
share