コード例 #1
0
        public static bool IsValueInList <T>(this T value, IEnumerable <T> checkList)
        {
            if (value is string)
            {
                return(SString.IsStringInList(value as string, checkList as IEnumerable <string>));
            }

            if (IsNullInList(value, checkList))
            {
                return(false);
            }

            foreach (T item in checkList)
            {
                if (Equals(value, item))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
        public static bool IsValueInList <T>(this T value, params T[] checkList)
        {
            if (value is string)
            {
                return(SString.IsStringInList(value as string, checkList as string[]));
            }

            if (IsNullInList(value, checkList))
            {
                return(false);
            }

            foreach (T item in checkList)
            {
                if (Equals(value, item))
                {
                    return(true);
                }
            }

            return(false);
        }