Beispiel #1
0
 public IEnumerator <IGroupingExpression <TKey, TElement> > GetEnumerator()
 {
     if (notifyEnumerable != null)
     {
         return(notifyEnumerable.GetEnumerator());
     }
     return(SL.GroupBy(Source, PredicateCompiled, Comparer).Select(g => new GroupingExpression(g, this)).GetEnumerator());
 }
Beispiel #2
0
    public void BlinqShouldEqualLinqNativeArrayGroupByKey([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() =>
        {
            var groupBy = Linq.GroupBy(source, SelectSelf <int>().Invoke);
            return(Linq.ToArray(groupBy));
        });
        var actual = ExceptionAndValue(() =>
        {
            var groupBy = Linq.Cast <IGrouping <int, int> >(Blinq.GroupBy(source, SelectSelf <int>()));
            return(Linq.ToArray(groupBy));
        });

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Beispiel #3
0
    public void BlinqShouldEqualLinqNativeArrayGroupByThenSelectCount([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() =>
        {
            var groupBy = Linq.GroupBy(source, SelectSelf <int>().Invoke, (key, values) => key + Linq.Count(values));
            return(Linq.ToArray(groupBy));
        });
        var actual = ExceptionAndValue(() =>
        {
            var groupBy = Blinq.GroupBy(source, SelectSelf <int>(), SelectGrouping);
            return(Linq.ToArray(groupBy));
        });

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Beispiel #4
0
 public static IEnumerable <TResult> GroupBy <TSource, TKey, TElement, TResult>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TElement> elementSelector, Func <TKey, IEnumerable <TElement>, TResult> resultSelector, IEqualityComparer <TKey> comparer) =>
 LinqEnumerable.GroupBy(source, keySelector, elementSelector, resultSelector, comparer);
Beispiel #5
0
 public static IEnumerable <IGrouping <TKey, TElement> > GroupBy <TSource, TKey, TElement>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, Func <TSource, TElement> elementSelector) =>
 LinqEnumerable.GroupBy(source, keySelector, elementSelector);
Beispiel #6
0
 public static IEnumerable <IGrouping <TKey, TSource> > GroupBy <TSource, TKey>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, IEqualityComparer <TKey> comparer) =>
 LinqEnumerable.GroupBy(source, keySelector, comparer);
Beispiel #7
0
 public static IEnumerable <TResult> GroupBy <TSource, TKey, TResult>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, Func <TKey, IEnumerable <TSource>, TResult> resultSelector) =>
 LinqEnumerable.GroupBy(source, keySelector, resultSelector);
 public static IEnumerable <IGrouping <TKey, TSource> > GroupBy <TSource, TKey>(this IEnumerable <TSource> source, Func <TSource, TKey> keySelector)
 => Enumerable.GroupBy(source, keySelector);
Beispiel #9
0
 public void LinqArray()
 {
     MakeMeasurement(() => Linq.ToList(Linq.GroupBy(source, SelectSelf <int>().Invoke, GroupByLinqSelector)), "Linq").Run();
 }