2014-06-04 22:32:40 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Extensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class ListHelper
|
|
|
|
|
|
{
|
2014-06-29 15:59:52 -04:00
|
|
|
|
public static bool ContainsIgnoreCase(List<string> list, string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (value == null)
|
|
|
|
|
|
{
|
2016-07-30 15:19:46 -04:00
|
|
|
|
throw new ArgumentNullException("value");
|
2014-06-29 15:59:52 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return list.Contains(value, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
}
|
|
|
|
|
|
public static bool ContainsIgnoreCase(string[] list, string value)
|
2014-06-04 22:32:40 -04:00
|
|
|
|
{
|
|
|
|
|
|
if (value == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException("value");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return list.Contains(value, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
}
|
2014-07-18 15:07:28 -04:00
|
|
|
|
|
|
|
|
|
|
public static bool ContainsAnyIgnoreCase(string[] list, string[] values)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (values == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException("values");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string val in values)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ContainsIgnoreCase(list, val))
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2014-06-04 22:32:40 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|