예제 #1
0
        private Func <Boolean> GetProcessingDelegate()
        {
            if (SourcePipe1 == null || SourcePipe2 == null)
            {
                return(() => false);
            }

            if (ZipDelegate != null)
            {
                return () =>
                       {
                           if (SourcePipe1.MoveNext() && SourcePipe2.MoveNext())
                           {
                               _CurrentElement = ZipDelegate(SourcePipe1.Current,
                                                             SourcePipe2.Current);

                               return true;
                           }

                           return false;
                       }
            }
            ;

            if (CountedZipDelegate != null)
            {
                return () =>
                       {
                           if (SourcePipe1.MoveNext() && SourcePipe2.MoveNext())
                           {
                               _CurrentElement = CountedZipDelegate(SourcePipe1.Current,
                                                                    SourcePipe2.Current,
                                                                    Counter++);

                               return true;
                           }

                           return false;
                       }
            }
            ;

            return(() => false);
        }
예제 #2
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// True if the enumerator was successfully advanced to the next
        /// element; false if the enumerator has passed the end of the
        /// collection.
        /// </returns>
        public override Boolean MoveNext()
        {
            while (true)
            {
                if (CurrentPipe == null)
                {
                    if (!SourcePipe2.MoveNext())
                    {
                        return(false);
                    }

                    CurrentPipe = SourcePipe2.Current;
                }

                if (CurrentPipe.MoveNext())
                {
                    _CurrentElement = CurrentPipe.Current;
                    return(true);
                }

                CurrentPipe = null;
            }
        }