コード例 #1
0
        /// <summary>
        /// Joins an <see cref="IEnumerable{T}"/> into an existing <see cref="CombinedSortedEnumerable{T}"/>.
        /// </summary>
        /// <param name="a">The <see cref="IEnumerable{T}"/>.</param>
        /// <param name="b">The <see cref="CombinedSortedEnumerable{T}"/>.</param>
        /// <returns>A new <see cref="CombinedSortedEnumerable{T}"/> containing the full collection of enumerables.</returns>
        public static CombinedSortedEnumerable <T> operator +(IEnumerable <T> a, CombinedSortedEnumerable <T> b)
        {
            CombinedSortedEnumerable <T> cse = new CombinedSortedEnumerable <T>(b.comparison);

            cse.loaders = new List <IEnumerable <T> >();
            cse.loaders.Add(a);
            cse.loaders.AddRange(b.loaders);
            return(cse);
        }
コード例 #2
0
            internal Enumerator(CombinedSortedEnumerable <T> loader)
            {
                this.comparison = loader.comparison;
                this.current    = default(T);
                this.firstDone  = false;

                this.loaders = new List <IEnumerator <T> >();
                for (int i = 0; i < loader.loaders.Count; i++)
                {
                    this.loaders.Add(loader.loaders[i].GetEnumerator());
                }
            }
コード例 #3
0
        /// <summary>
        /// Adds an additional enumerable to a <see cref="CombinedSortedEnumerable{T}"/>.
        /// </summary>
        /// <param name="combinedLoader">The <see cref="CombinedSortedEnumerable{T}"/> to which the enumerable is added.</param>
        /// <param name="loader">The <see cref="IEnumerable{T}"/> that is added.</param>
        /// <returns>A new <see cref="CombinedSortedEnumerable{T}"/> containing the full collection of enumerables.</returns>
        public static CombinedSortedEnumerable <T> Add(CombinedSortedEnumerable <T> combinedLoader, IEnumerable <T> loader)
        {
            if (loader is CombinedSortedEnumerable <T> )
            {
                return(combinedLoader + (loader as CombinedSortedEnumerable <T>));
            }

            CombinedSortedEnumerable <T> cse = new CombinedSortedEnumerable <T>(combinedLoader.comparison, loader);

            for (int i = 0; i < combinedLoader.loaders.Count; i++)
            {
                cse.loaders.Insert(i, combinedLoader.loaders[i]);
            }
            return(cse);
        }