ListHelper.cs 1007 B

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