Reputation: 63
How we can define and use the multiple description attribute on an Enum?
public enum EnumWithDescription
{
[CustomDescritption("job-view")]
[Description("analyics-job-view")]
JobView
}
class CustomDescritption: DescriptionAttribute
{
private string extraInfo;
public string ExtraInfo { get { return extraInfo; } set { extraInfo = value; } }
public MyDescritptionAttribute(string description)
{
this.DescriptionValue = description;
this.extraInfo = "";
}
}
Upvotes: 2
Views: 3921
Reputation: 8455
decorate attribute with AllowMultiple
[AttributeUsage(AllowMultiple = true)]
class MyAttribute : Attribute {}
More info: msdn
Upvotes: 5