예제 #1
0
        public void Subscribe(ICompletableObserver observer)
        {
            var en = default(IEnumerator <ICompletableSource>);

            try
            {
                en = RequireNonNullRef(sources.GetEnumerator(), "The sources returned a null IEnumerator");
            }
            catch (Exception ex)
            {
                DisposableHelper.Error(observer, ex);
                return;
            }
            var parent = new ConcatDisposable(observer, en, delayErrors);

            observer.OnSubscribe(parent);
            parent.Drain();
        }
예제 #2
0
        public void Subscribe(ICompletableObserver observer)
        {
            var srcs = sources;
            var n    = srcs.Length;

            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }

            if (n == 1)
            {
                srcs[0].Subscribe(observer);
                return;
            }

            var parent = new ConcatDisposable(observer, srcs, delayErrors);

            observer.OnSubscribe(parent);
            parent.Drain();
        }