Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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());
        }
Esempio n. 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());
        }