Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • It is not really clear what is your question. Can you explain it better? Also those 3 enums are confusing. Are they shows your attempts or..? Commented Feb 16, 2015 at 19:33
  • My question is, can I check an enum item if it exists using another enum item with a list of values. In the example above, I'm checking ifof TestEnum01.xls exists in the list of values in TestEnum01.Available. But the "if (result1 != TestEnum01.Available)" does not seem to work. Commented Feb 16, 2015 at 19:38
  • 1
    Use HasFlag method if(result.HasFlag(TestEnum01.xls)) and to get nice ToString conversion, use FlagsAttribute Commented Feb 16, 2015 at 19:42
  • Thanks. I used the HasFlag to default the value to doc if enum is unknown or not in the list of Available values. "if (!TestEnum01.Available.HasFlag(input) || (input == TestEnum01.unknown))" Commented Feb 16, 2015 at 20:04