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