ConcatSink.cs 880 B

12345678910111213141516171819202122232425262728293031
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. namespace System.Reactive
  7. {
  8. abstract class ConcatSink<TSource> : TailRecursiveSink<TSource>
  9. {
  10. public ConcatSink(IObserver<TSource> observer, IDisposable cancel)
  11. : base(observer, cancel)
  12. {
  13. }
  14. protected override IEnumerable<IObservable<TSource>> Extract(IObservable<TSource> source)
  15. {
  16. var concat = source as IConcatenatable<TSource>;
  17. if (concat != null)
  18. return concat.GetSources();
  19. return null;
  20. }
  21. public override void OnCompleted()
  22. {
  23. _recurse();
  24. }
  25. }
  26. }