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?

Community
  • 1
  • 1
Martin
  • 1,986
  • 15
  • 32

1 Answers1

1

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

Samer Aburabie
  • 248
  • 2
  • 8