示例#1
0
        public static List <T> AsTempList <T>(this IEnumerable <T> collection)
        {
            var list = TemporaryPool.EmptyList <T>();

            foreach (var item in collection)
            {
                list.Add(item);
            }
            return(list);
        }
示例#2
0
        public static List <T> AsTempList <T>(this IEnumerable <T> collection)
        {
            var list = TemporaryPool.EmptyList <T>();

            if (collection != null)
            {
                list.AddRange(collection);
            }
            return(list);
        }
示例#3
0
        public static T[] Merge <T>(IEnumerable <T> collection1, IEnumerable <T> collection2)
        {
            var list = TemporaryPool.EmptyList <T>();

            if (collection1 != null)
            {
                list.AddRange(collection1);
            }
            if (collection2 != null)
            {
                list.AddRange(collection2);
            }
            return(list.ToArray());
        }
示例#4
0
        public static T[] Merge <T>(params IEnumerable <T>[] collections)
        {
            if (collections == null)
            {
                return(TemporaryPool.EmptyArray <T>());
            }
            var list = TemporaryPool.EmptyList <T>();

            for (var i = 0; i < collections.Length; ++i)
            {
                var col = collections[i];
                if (col == null)
                {
                    continue;
                }
                list.AddRange(col);
            }
            return(list.ToArray());
        }