EnumExt.cs 489 B

12345678910111213141516171819
  1. using System;
  2. namespace Quadarax.Foundation.Core.Value.Extensions
  3. {
  4. public static class EnumExt
  5. {
  6. public static bool In<TEnum>(this TEnum owner, params object[] values) where TEnum : Enum
  7. {
  8. if (values == null) throw new ArgumentNullException(nameof(values));
  9. foreach (var value in values)
  10. {
  11. if (Equals(owner, value)) return true;
  12. }
  13. return false;
  14. }
  15. }
  16. }