public static Dictionary <TKey, TValue> ToDictionary <T, C, TKey, TValue>(this Slinq <T, C> slinq, Func <T, TKey> keyFunc, Func <T, TValue> valueFunc) { return(slinq.Select((item, tuple) => new KeyValuePair <TKey, TValue>(tuple.Item1(item), tuple.Item2(item)), Tuple.Create(keyFunc, valueFunc)) .AddTo(DictionaryPool <TKey, TValue> .Instance.Borrow())); }
public static Slinq <T, FlattenContext <T, C1, C2> > Flatten(Slinq <Slinq <T, C1>, C2> slinq) { return(new Slinq <T, FlattenContext <T, C1, C2> >( skip, remove, dispose, new FlattenContext <T, C1, C2>(slinq))); }
#pragma warning restore 0414 private FlattenContext(Slinq <Slinq <T, C1>, C2> chained) { this.needsMove = false; this.chained = chained; this.selected = chained.current.isSome ? chained.current.value : new Slinq <T, C1>(); this.bd = BacktrackDetector.Borrow(); }
public static Slinq <List <T>, BufferPredicateContext <T, C> > BufferWhere(Slinq <T, C> slinq, DelegateFunc <T, T, bool> predicate) { return(new Slinq <List <T>, BufferPredicateContext <T, C> >( skip, remove, dispose, new BufferPredicateContext <T, C>(slinq, predicate))); }
public static Slinq <T, ConcatContext <C2, T, C> > Concat(Slinq <T, C> first, Slinq <T, C2> second) { return(new Slinq <T, ConcatContext <C2, T, C> >( skip, remove, dispose, new ConcatContext <C2, T, C>(first, second))); }
public static Slinq <U, SelectSlinqContext <U, UC, T, C> > SelectMany(Slinq <T, C> slinq, Func <T, Slinq <U, UC> > selector) { return(new Slinq <U, SelectSlinqContext <U, UC, T, C> >( skip, remove, dispose, new SelectSlinqContext <U, UC, T, C>(slinq, selector))); }
public static Slinq <T, HashSetContext <T, C> > Except(Slinq <T, C> slinq, Disposable <HashSet <T> > hashSet, bool release) { return(new Slinq <T, HashSetContext <T, C> >( exceptSkip, exceptRemove, dispose, new HashSetContext <T, C>(slinq, hashSet, release))); }
#pragma warning restore 0414 private IntContext(Slinq <T, C> chained, int count) { this.needsMove = false; this.chained = chained; this.count = count; this.bd = BacktrackDetector.Borrow(); }
#pragma warning restore 0414 private ConcatContext(Slinq <T, C> first, Slinq <T, C2> second) { this.needsMove = false; this.first = first; this.second = second; this.bd = BacktrackDetector.Borrow(); }
public static T[] ToArray <T, C>(this Slinq <T, C> slinq) { using (var list = ListPool <T> .Instance.BorrowDisposable()) { slinq.AddTo(list); return(list.value.ToArray()); } }
#pragma warning restore 0414 private SelectContext(Slinq <T, C> chained, Func <T, U> selector) { needsMove = false; this.chained = chained; this.selector = selector; bd = BacktrackDetector.Borrow(); }
public static Slinq <U, SelectContext <U, T, C> > Select(Slinq <T, C> slinq, Func <T, U> selector) { return(new Slinq <U, SelectContext <U, T, C> >( skip, remove, dispose, new SelectContext <U, T, C>(slinq, selector))); }
public static Slinq <U, AggregateContext <U, T, C> > AggregateRunning(Slinq <T, C> slinq, U seed, Func <U, T, U> selector) { return(new Slinq <U, AggregateContext <U, T, C> >( skip, remove, dispose, new AggregateContext <U, T, C>(slinq, seed, selector))); }
public static Slinq <T, IntContext <T, C> > Take(Slinq <T, C> slinq, int count) { return(new Slinq <T, IntContext <T, C> >( skip, remove, dispose, new IntContext <T, C>(slinq, count))); }
public static Slinq <Tuple <T, T2>, ZipContext <T2, C2, T, C> > Zip(Slinq <T, C> left, Slinq <T2, C2> right, ZipRemoveFlags removeFlags) { return(new Slinq <Tuple <T, T2>, ZipContext <T2, C2, T, C> >( skip, remove, dispose, new ZipContext <T2, C2, T, C>(left, right, removeFlags))); }
public static Slinq <T, HashSetContext <T, C> > Intersect(Slinq <T, C> slinq, Disposable <HashSet <T> > hashSet, bool release) { return(new Slinq <T, HashSetContext <T, C> >( intersectSkip, intersectRemove, dispose, new HashSetContext <T, C>(slinq, hashSet, release))); }
public static Slinq <U, SelectOptionContext <U, T, C> > SelectMany(Slinq <T, C> slinq, DelegateFunc <T, Option <U> > selector) { return(new Slinq <U, SelectOptionContext <U, T, C> >( skip, remove, dispose, new SelectOptionContext <U, T, C>(slinq, selector))); }
#pragma warning restore 0414 private SelectOptionContext(Slinq <T, C> chained, DelegateFunc <T, Option <U> > selector) { this.needsMove = false; this.chained = chained; this.selector = selector; this.bd = BacktrackDetector.Borrow(); }
public static Slinq <T, PredicateContext <T, C> > Where(Slinq <T, C> slinq, DelegateFunc <T, bool> predicate) { return(new Slinq <T, PredicateContext <T, C> >( whereSkip, whereRemove, dispose, new PredicateContext <T, C>(slinq, predicate))); }
#pragma warning restore 0414 private PredicateContext(Slinq <T, C> chained, DelegateFunc <T, bool> predicate) { this.needsMove = false; this.chained = chained; this.predicate = predicate; this.bd = BacktrackDetector.Borrow(); }
public static Slinq <T, PredicateContext <T, C> > TakeWhile(Slinq <T, C> slinq, DelegateFunc <T, bool> predicate) { return(new Slinq <T, PredicateContext <T, C> >( takeWhileSkip, takeWhileRemove, dispose, new PredicateContext <T, C>(slinq, predicate))); }
public static Slinq <T, EitherContext <C2, T, C> > Right(Slinq <T, C2> right) { return(new Slinq <T, EitherContext <C2, T, C> >( skip, remove, dispose, new EitherContext <C2, T, C>(default(Slinq <T, C>), right, false))); }
public static Slinq <T, EitherContext <C2, T, C> > Left(Slinq <T, C> left) { return(new Slinq <T, EitherContext <C2, T, C> >( skip, remove, dispose, new EitherContext <C2, T, C>(left, default(Slinq <T, C2>), true))); }
#pragma warning restore 0414 private ZipContext(Slinq <T, C> left, Slinq <T2, C2> right, ZipRemoveFlags removeFlags) { this.needsMove = false; this.left = left; this.right = right; this.removeFlags = removeFlags; this.bd = BacktrackDetector.Borrow(); }
public static async Task <Slinq <T, IListContext <T> > > ToAsync <T, C>(this Slinq <Task <T>, C> slinq) { var list = slinq.ToList(); //ToList borrows from pool. var results = await Task.WhenAll(list); ListPool <Task <T> > .Instance.Release(list); return(results.Slinq()); }
#pragma warning restore 0414 private HashSetContext(Slinq <T, C> chained, Disposable <HashSet <T> > hashSet, bool release) { this.needsMove = false; this.chained = chained; this.hashSet = hashSet; this.release = release; this.bd = BacktrackDetector.Borrow(); }
#pragma warning restore 0414 private EitherContext(Slinq <T, C> left, Slinq <T, C2> right, bool isLeft) { needsMove = false; this.isLeft = isLeft; this.left = left; this.right = right; bd = BacktrackDetector.Borrow(); }
#pragma warning restore 0414 private AggregateContext(Slinq <T, C> chained, U seed, Func <U, T, U> selector) { needsMove = false; this.chained = chained; acc = seed; this.selector = selector; bd = BacktrackDetector.Borrow(); }
#pragma warning restore 0414 private SelectSlinqContext(Slinq <T, C> chained, DelegateFunc <T, Slinq <U, UC> > selector) { this.needsMove = false; this.chained = chained; this.selected = chained.current.isSome ? selector(chained.current.value) : new Slinq <U, UC>(); this.selector = selector; this.bd = BacktrackDetector.Borrow(); }
#pragma warning restore 0414 private BufferPredicateContext(Slinq <T, C> slinq, DelegateFunc <T, T, bool> pred) { needsMove = false; chained = slinq; predicate = pred; acc = null; release = ListPool <List <T> > .Instance.Borrow(); bd = BacktrackDetector.Borrow(); }