Beispiel #1
0
        /// <summary>
        /// 基本的ToLookup方法
        /// </summary>
        /// <typeparam name="TKey">分组的键</typeparam>
        /// <typeparam name="TSource">数据源中的每一个实体</typeparam>
        /// <typeparam name="TElement">筛选后的数据</typeparam>
        /// <param name="source">数据源</param>
        /// <param name="keyselector">选择分组键的方法</param>
        /// <param name="elementselector">筛选要选取的数据</param>
        /// <param name="comparer">用户定义的比较器</param>
        /// <returns></returns>
        public static 系统内置接口.ILookup <TKey, TElement> ToLookup <TKey, TSource, TElement>(this IEnumerable <TSource> source, 内置委托.Func <TSource, TKey> keyselector, 内置委托.Func <TSource, TElement> elementselector, 系统内置接口.IEqualityComparer <TKey> comparer)
        {
            MyLookup <TKey, TElement> lookup = new MyLookup <TKey, TElement>(comparer);

            lookup.Create(source, keyselector, elementselector);
            return(lookup);
        }
Beispiel #2
0
        public static 系统内置接口.ILookup <TKey, TSource> ToLookup <TKey, TSource>(this IEnumerable <TSource> source, 内置委托.Func <TSource, TKey> keyselector, 系统内置接口.IEqualityComparer <TKey> comparer)
        {
            MyLookup <TKey, TSource> lookup = new MyLookup <TKey, TSource>(comparer);

            lookup.Create(source, keyselector, 数据结构.IdentityFunction <TSource> .Instance);
            return(lookup);
        }
Beispiel #3
0
        public static 数据结构.IEnumerable <系统内置接口.IGrouping <TKey, TSource> > GroupBy <TSource, TKey>(this IEnumerable <TSource> source, 内置委托.Func <TSource, TKey> keyselector, 内置委托.Func <TSource, TSource> elementselector, 系统内置接口.IEqualityComparer <TKey> comparer)
        {
            MyLookup <TKey, TSource> lookup = new MyLookup <TKey, TSource>(comparer);

            lookup.Create(source, keyselector, elementselector);
            return(lookup.GetPerGroup());
        }
Beispiel #4
0
        public static System.Collections.Generic.IEnumerable <TResult> GroupBy <TSource, TKey, TResult>(this IEnumerable <TSource> source, 内置委托.Func <TSource, TKey> keyselector, Func <TKey, System.Collections.Generic.IEnumerable <TSource>, TResult> resultselector)
        {
            MyLookup <TKey, TSource> lookup = new MyLookup <TKey, TSource>(null);

            lookup.Create(source, keyselector, IdentityFunction <TSource> .Instance);
            return(lookup.StaticResult(resultselector));
        }
Beispiel #5
0
        public static 数据结构.IEnumerable <系统内置接口.IGrouping <TKey, TSource> > GroupBy <TSource, TKey>(this IEnumerable <TSource> source, 内置委托.Func <TSource, TKey> keyselector)
        {
            MyLookup <TKey, TSource> lookup = new MyLookup <TKey, TSource>(null);

            lookup.Create(source, keyselector, IdentityFunction <TSource> .Instance);
            return(lookup.GetPerGroup());
        }