ConcatSink.cs 802 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. using System;
  3. using System.Collections.Generic;
  4. namespace System.Reactive
  5. {
  6. abstract class ConcatSink<TSource> : TailRecursiveSink<TSource>
  7. {
  8. public ConcatSink(IObserver<TSource> observer, IDisposable cancel)
  9. : base(observer, cancel)
  10. {
  11. }
  12. protected override IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source)
  13. {
  14. var concat = source as IConcatenatable<TSource>;
  15. if (concat != null)
  16. return concat.GetSources();
  17. return null;
  18. }
  19. public override void OnCompleted()
  20. {
  21. _recurse();
  22. }
  23. }
  24. }