aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Extensions/ListHelper.cs
blob: cfcb229c8fb38ef4e76adcfcfc03add00fe71a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;

namespace MediaBrowser.Model.Extensions
{
    public static class ListHelper
    {
        public static bool ContainsIgnoreCase(string[] list, string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            return list.Contains(value, StringComparer.OrdinalIgnoreCase);
        }

        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;
        }
    }
}