ListHelper.cs 889 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace MediaBrowser.Model.Extensions
  5. {
  6. public static class ListHelper
  7. {
  8. public static bool ContainsIgnoreCase(string[] list, string value)
  9. {
  10. if (value == null)
  11. {
  12. throw new ArgumentNullException("value");
  13. }
  14. return list.Contains(value, StringComparer.OrdinalIgnoreCase);
  15. }
  16. public static bool ContainsAnyIgnoreCase(string[] list, string[] values)
  17. {
  18. if (values == null)
  19. {
  20. throw new ArgumentNullException("values");
  21. }
  22. foreach (string val in values)
  23. {
  24. if (ContainsIgnoreCase(list, val))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. }
  32. }