ShortcutExtensionMethod.cs 792 B

1234567891011121314151617181920
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. namespace VCommon.Collections
  4. {
  5. public static class ShortcutExtensionMethod
  6. {
  7. public static bool In(this byte source, params byte[] toChecks) => toChecks.Contains(source);
  8. public static bool In(this byte source, IEnumerable<byte> toChecks) => toChecks.Contains(source);
  9. public static bool In<T>(this T source, params T[] toChecks) => toChecks.Contains(source);
  10. public static bool In<T>(this T source, IEnumerable<T> toChecks) => toChecks.Contains(source);
  11. public static bool NotIn<T>(this T source, params T[] toChecks) => false == toChecks.Contains(source);
  12. public static bool NotIn<T>(this T source, IEnumerable<T> toChecks) => false == toChecks.Contains(source);
  13. }
  14. }