public static int Count <TSource>(this IReadOnlyList <TSource> source, Func <TSource, bool> predicate)
        {
            switch (source)
            {
            case TSource[] array:
                return(ArrayExtensions.Count <TSource>(array, predicate));

            default:
                return(ReadOnlyList.Count <IReadOnlyList <TSource>, IEnumerator <TSource>, TSource>(source, predicate));
            }
        }
Example #2
0
 public static int Count <TSource>(this List <TSource> source, Func <TSource, bool> predicate)
 => ReadOnlyList.Count <List <TSource>, List <TSource> .Enumerator, TSource>(source, predicate);