Concat.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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.Collections.Generic;
  5. namespace System.Reactive.Linq.ObservableImpl
  6. {
  7. internal sealed class Concat<TSource> : Producer<TSource, Concat<TSource>._>, IConcatenatable<TSource>
  8. {
  9. private readonly IEnumerable<IObservable<TSource>> _sources;
  10. public Concat(IEnumerable<IObservable<TSource>> sources)
  11. {
  12. _sources = sources;
  13. }
  14. protected override _ CreateSink(IObserver<TSource> observer, IDisposable cancel) => new _(observer, cancel);
  15. protected override IDisposable Run(_ sink) => sink.Run(_sources);
  16. public IEnumerable<IObservable<TSource>> GetSources() => _sources;
  17. internal sealed class _ : ConcatSink<TSource>
  18. {
  19. public _(IObserver<TSource> observer, IDisposable cancel)
  20. : base(observer, cancel)
  21. {
  22. }
  23. }
  24. }
  25. }