Пример #1
0
        public static int Count <TSource>(this List <TSource> source, Func <TSource, bool> predicate)
        {
            var aggregate = new CountIf <TSource>(predicate);

            ListSegmentNode.ProcessList(source, ref aggregate);
            return(aggregate.GetResult());
        }
Пример #2
0
        public static int Count <TSource>(this ReadOnlyMemory <TSource> source, Func <TSource, bool> predicate)
        {
            var aggregate = new CountIf <TSource>(predicate);

            MemoryNode.ProcessMemory(source, ref aggregate);
            return(aggregate.GetResult());
        }
Пример #3
0
        public static int Count <TSource>(this TSource[] source, Func <TSource, bool> predicate)
        {
            var aggregate = new CountIf <TSource>(predicate);

            ArrayNode.ProcessArray(source, ref aggregate);
            return(aggregate.GetResult());
        }