2

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 = "";
    }
}
0

1 Answer 1

5

decorate attribute with AllowMultiple

[AttributeUsage(AllowMultiple = true)]
class MyAttribute : Attribute {}

More info: msdn

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.