Example #1
0
        public static IEnumerable<char> WhereAny(this IEnumerable<char> chars, CharTypes types)
        {
            var predicate = Enum.GetValues(typeof(CharTypes))
                .Cast<CharTypes>()
                .ToDictionary(x => x, MapPredicate)
                .Where(x => types.HasFlag(x.Key))
                .Select(x => x.Value)
                .AnyTrue();

            return chars.Where(predicate);
        }
Example #2
0
        public static IEnumerable <char> WhereAny(this IEnumerable <char> chars, CharTypes types)
        {
            var predicate = Enum.GetValues(typeof(CharTypes))
                            .Cast <CharTypes>()
                            .ToDictionary(x => x, MapPredicate)
                            .Where(x => types.HasFlag(x.Key))
                            .Select(x => x.Value)
                            .AnyTrue();

            return(chars.Where(predicate));
        }