1
0

ConnectableObservable.cs 798 B

123456789101112131415161718192021222324252627282930
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Reactive.Linq;
  6. using System.Reactive.Subjects;
  7. namespace ReactiveTests.Tests
  8. {
  9. internal class ConnectableObservable<T> : IConnectableObservable<T>
  10. {
  11. private readonly IConnectableObservable<T> _o;
  12. public ConnectableObservable(IObservable<T> o, ISubject<T, T> s)
  13. {
  14. _o = o.Multicast(s);
  15. }
  16. public IDisposable Connect()
  17. {
  18. return _o.Connect();
  19. }
  20. public IDisposable Subscribe(IObserver<T> observer)
  21. {
  22. return _o.Subscribe(observer);
  23. }
  24. }
  25. }