Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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());
        }
Exemplo 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());
        }