public static bool Contains <TSource>(this IReadOnlyList <TSource> source, TSource value, IEqualityComparer <TSource> comparer)
        {
            switch (source)
            {
            case TSource[] array:
                return(ArrayExtensions.Contains <TSource>(array, value, comparer));

            default:
                return(ReadOnlyList.Contains <IReadOnlyList <TSource>, IEnumerator <TSource>, TSource>(source, value, comparer));
            }
        }
예제 #2
0
 public static bool Contains <TSource>(this ImmutableList <TSource> source, TSource value, IEqualityComparer <TSource>?comparer)
 => ReadOnlyList.Contains <ImmutableList <TSource>, TSource>(source, value, comparer);
 public static bool Contains <TList, TSource>(this TList source, TSource value, IEqualityComparer <TSource>?comparer = null)
     where TList : notnull, IReadOnlyList <TSource>
 => ReadOnlyList.Contains <TList, TSource>(source, value, comparer, 0, source.Count);