0

I’d like to use an attribute for parsing strings to enum values (something like in this question), but I’d like to use multiple strings for each enum value, e.g.:

enum Foo
{
    [SomeAttribute("A BAR")]
    [SomeAttribute("The BAR")]
    Bar,
    [SomeAttribute("A BUZZ")]
    [SomeAttribute("The BUZZ")]
    Buzz
}

That means that I cannot use Description nor DisplayName because they have AllowMultiple=false.

I know that it is simple to create my own attribute, but:

Does the .NET framework already contain a suitable attribute that I can use for this?

1 Answer 1

1

No it doesn't. Go with creating your own attribute.

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.