Example #1
0
        public IEnumerable <TResult> ApplyResultSelector <TResult>(Func <TKey, IEnumerable <TElement>, TResult> resultSelector)
        {
            Grouping <TKey, TElement> g = _lastGrouping;

            if (g != null)
            {
                do
                {
                    g = g._next;
                    g.Trim();
                    yield return(resultSelector(g._key, g._elements));
                }while (g != _lastGrouping);
            }
        }
Example #2
0
        internal List <TResult> ToList <TResult>(Func <TKey, IEnumerable <TElement>, TResult> resultSelector)
        {
            List <TResult>            list = new List <TResult>(_count);
            Grouping <TKey, TElement> g    = _lastGrouping;

            if (g != null)
            {
                do
                {
                    g = g._next;
                    g.Trim();
                    list.Add(resultSelector(g._key, g._elements));
                }while (g != _lastGrouping);
            }

            return(list);
        }
Example #3
0
        internal TResult[] ToArray <TResult>(Func <TKey, IEnumerable <TElement>, TResult> resultSelector)
        {
            TResult[] array             = new TResult[_count];
            int       index             = 0;
            Grouping <TKey, TElement> g = _lastGrouping;

            if (g != null)
            {
                do
                {
                    g = g._next;
                    g.Trim();
                    array[index] = resultSelector(g._key, g._elements);
                    ++index;
                }while (g != _lastGrouping);
            }

            return(array);
        }