public static TSource Single <TSource>(this IReadOnlyList <TSource> source, Func <TSource, bool> predicate) { switch (source) { case TSource[] array: return(ArrayExtensions.Single <TSource>(array, predicate)); default: return(ReadOnlyList.Single <IReadOnlyList <TSource>, IEnumerator <TSource>, TSource>(source, predicate)); } }
public static Option <TSource> Single <TSource>(this ImmutableList <TSource> source) => ReadOnlyList.Single <ImmutableList <TSource>, TSource>(source);
public static Option <TSource> Single <TSource>(this List <TSource> source) => ReadOnlyList.Single <List <TSource>, TSource>(source);