예제 #1
0
 public static ReadOnlyListExtensions.SelectManyEnumerable <ValueWrapper <TSource>, TSource, TSubEnumerable, TSubEnumerator, TResult, TSelector> SelectMany <TSource, TSubEnumerable, TSubEnumerator, TResult, TSelector>(
     this ImmutableList <TSource> source,
     TSelector selector = default)
     where TSubEnumerable : IValueEnumerable <TResult, TSubEnumerator>
     where TSubEnumerator : struct, IEnumerator <TResult>
     where TSelector : struct, IFunction <TSource, TSubEnumerable>
 => ReadOnlyListExtensions.SelectMany <ValueWrapper <TSource>, TSource, TSubEnumerable, TSubEnumerator, TResult, TSelector>(new ValueWrapper <TSource>(source), selector);
예제 #2
0
        static IMemoryOwner <TSource> ToArray <TList, TSource>(this TList source, int offset, int count, MemoryPool <TSource> pool)
            where TList : notnull, IReadOnlyList <TSource>
        {
            Debug.Assert(pool is object);

            var result = pool.RentSliced(count);

            ReadOnlyListExtensions.Copy <TList, TSource>(source, offset, result.Memory.Span, count);
            return(result);
        }
예제 #3
0
        static TResult[] ToArray <TList, TSource, TResult>(this TList source, NullableSelector <TSource, TResult> selector, int offset, int count)
            where TList : notnull, IReadOnlyList <TSource>
        {
#if NET5_0
            var result = GC.AllocateUninitializedArray <TResult>(count);
#else
            var result = new TResult[count];
#endif
            ReadOnlyListExtensions.Copy(source, offset, result, 0, count, selector);
            return(result);
        }
예제 #4
0
 public static Dictionary <TKey, TElement> ToDictionary <TSource, TKey, TElement>(this ImmutableList <TSource> source, Selector <TSource, TKey> keySelector, NullableSelector <TSource, TElement> elementSelector, IEqualityComparer <TKey>?comparer = default)
     where TKey : notnull
 => ReadOnlyListExtensions.ToDictionary <ImmutableList <TSource>, TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
예제 #5
0
 public static ReadOnlyListExtensions.SelectAtEnumerable <ValueWrapper <TSource>, TSource, TResult, FunctionWrapper <TSource, int, TResult> > Select <TSource, TResult>(
     this ImmutableList <TSource> source,
     Func <TSource, int, TResult> selector)
 => ReadOnlyListExtensions.Select <ValueWrapper <TSource>, TSource, TResult>(new ValueWrapper <TSource>(source), selector);
예제 #6
0
 public static bool AnyAt <TSource, TPredicate>(this ImmutableList <TSource> source, TPredicate predicate = default)
     where TPredicate : struct, IFunction <TSource, int, bool>
 => ReadOnlyListExtensions.AnyAt <ValueWrapper <TSource>, TSource, TPredicate>(new ValueWrapper <TSource>(source), predicate);
예제 #7
0
 public static bool Any <TSource>(this ImmutableList <TSource> source)
 => ReadOnlyListExtensions.Any <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source));
예제 #8
0
 public static ReadOnlyListExtensions.DistinctEnumerable <ValueWrapper <TSource>, TSource> Distinct <TSource>(this ImmutableList <TSource> source, IEqualityComparer <TSource>?comparer = default)
 => ReadOnlyListExtensions.Distinct <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source), comparer);
예제 #9
0
 public static Option <TSource> First <TSource>(this ImmutableList <TSource> source)
 => ReadOnlyListExtensions.First <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source));
예제 #10
0
 public static int Count <TSource>(this ImmutableList <TSource> source)
 => ReadOnlyListExtensions.Count <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source));
 public static bool Contains <TSource>(this ImmutableArray <TSource> source, [AllowNull] TSource value, IEqualityComparer <TSource>?comparer)
 => ReadOnlyListExtensions.Contains <ImmutableArray <TSource>, TSource>(source, value, comparer);
 public static bool Any <TSource>(this ImmutableArray <TSource> source, PredicateAt <TSource> predicate)
 => ReadOnlyListExtensions.Any <ImmutableArray <TSource>, TSource>(source, predicate);
 public static ReadOnlyListExtensions.SkipTakeEnumerable <ImmutableArray <TSource>, TSource> Take <TSource>(this ImmutableArray <TSource> source, int count)
 => ReadOnlyListExtensions.Take <ImmutableArray <TSource>, TSource>(source, count);
예제 #14
0
 public static ReadOnlyListExtensions.WhereEnumerable <ImmutableList <TSource>, TSource> Where <TSource>(
     this ImmutableList <TSource> source,
     Predicate <TSource> predicate)
 => ReadOnlyListExtensions.Where <ImmutableList <TSource>, TSource>(source, predicate);
예제 #15
0
 public static bool All <TSource>(this ImmutableList <TSource> source, Predicate <TSource> predicate)
 => ReadOnlyListExtensions.All <ImmutableList <TSource>, TSource>(source, predicate);
 public static ReadOnlyListExtensions.SelectAtEnumerable <ImmutableArray <TSource>, TSource, TResult> SelectHyper <TSource, TResult>(
     this ImmutableArray <TSource> source,
     NullableSelectorAt <TSource, TResult> selector)
 => ReadOnlyListExtensions.Select <ImmutableArray <TSource>, TSource, TResult>(source, selector);
예제 #17
0
 public static ReadOnlyListExtensions.WhereAtEnumerable <ValueWrapper <TSource>, TSource, FunctionWrapper <TSource, int, bool> > Where <TSource>(
     this ImmutableList <TSource> source,
     Func <TSource, int, bool> predicate)
 => ReadOnlyListExtensions.Where <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source), predicate);
 public static ReadOnlyListExtensions.SelectManyEnumerable <ImmutableArray <TSource>, TSource, TSubEnumerable, TSubEnumerator, TResult> SelectMany <TSource, TSubEnumerable, TSubEnumerator, TResult>(
     this ImmutableArray <TSource> source,
     Selector <TSource, TSubEnumerable> selector)
     where TSubEnumerable : IValueEnumerable <TResult, TSubEnumerator>
     where TSubEnumerator : struct, IEnumerator <TResult>
 => ReadOnlyListExtensions.SelectMany <ImmutableArray <TSource>, TSource, TSubEnumerable, TSubEnumerator, TResult>(source, selector);
예제 #19
0
 public static Option <TSource> ElementAt <TSource>(this ImmutableList <TSource> source, int index)
 => ReadOnlyListExtensions.ElementAt <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source), index);
 public static ReadOnlyListExtensions.WhereAtEnumerable <ImmutableArray <TSource>, TSource> HyperWhere <TSource>(
     this ImmutableArray <TSource> source,
     PredicateAt <TSource> predicate)
 => ReadOnlyListExtensions.Where <ImmutableArray <TSource>, TSource>(source, predicate);
예제 #21
0
        public static Option <TSource> Single <TSource>(this ImmutableList <TSource> source)
#pragma warning disable HLQ005 // Avoid Single() and SingleOrDefault()
        => ReadOnlyListExtensions.Single <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source));
 public static Option <TSource> ElementAt <TSource>(this ImmutableArray <TSource> source, int index)
 => ReadOnlyListExtensions.ElementAt <ImmutableArray <TSource>, TSource>(source, index);
예제 #23
0
 public static ReadOnlyListExtensions.SkipTakeEnumerable <ValueWrapper <TSource>, TSource> Take <TSource>(this ImmutableList <TSource> source, int count)
 => ReadOnlyListExtensions.Take <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source), count);
 public static Option <TSource> First <TSource>(this ImmutableArray <TSource> source)
 => ReadOnlyListExtensions.First <ImmutableArray <TSource>, TSource>(source);
예제 #25
0
 public static bool Any <TSource>(this ImmutableList <TSource> source, Func <TSource, int, bool> predicate)
 => ReadOnlyListExtensions.Any <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source), predicate);
 public static Option <TSource> Single <TSource>(this ImmutableArray <TSource> source)
 => ReadOnlyListExtensions.Single <ImmutableArray <TSource>, TSource>(source);
예제 #27
0
 public static bool Contains <TSource>(this ImmutableList <TSource> source, TSource value, IEqualityComparer <TSource>?comparer = default)
 => ReadOnlyListExtensions.Contains <ValueWrapper <TSource>, TSource>(new ValueWrapper <TSource>(source), value, comparer);
 public static ReadOnlyListExtensions.DistinctEnumerable <ImmutableArray <TSource>, TSource> Distinct <TSource>(this ImmutableArray <TSource> source, IEqualityComparer <TSource>?comparer = null)
 => ReadOnlyListExtensions.Distinct <ImmutableArray <TSource>, TSource>(source, comparer);
예제 #29
0
 public static ReadOnlyListExtensions.SelectAtEnumerable <ValueWrapper <TSource>, TSource, TResult, TSelector> SelectAt <TSource, TResult, TSelector>(
     this ImmutableList <TSource> source,
     TSelector selector = default)
     where TSelector : struct, IFunction <TSource, int, TResult>
 => ReadOnlyListExtensions.SelectAt <ValueWrapper <TSource>, TSource, TResult, TSelector>(new ValueWrapper <TSource>(source), selector);
예제 #30
0
 public static TSource[] ToArray <TSource>(this ImmutableList <TSource> source)
 => ReadOnlyListExtensions.ToArray <ImmutableList <TSource>, TSource>(source);