Never.cs 780 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. namespace UniRx.Operators
  3. {
  4. internal class NeverObservable<T> : OperatorObservableBase<T>
  5. {
  6. public NeverObservable()
  7. : base(false)
  8. {
  9. }
  10. protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel)
  11. {
  12. return Disposable.Empty;
  13. }
  14. }
  15. internal class ImmutableNeverObservable<T> : IObservable<T>, IOptimizedObservable<T>
  16. {
  17. internal static ImmutableNeverObservable<T> Instance = new ImmutableNeverObservable<T>();
  18. public bool IsRequiredSubscribeOnCurrentThread()
  19. {
  20. return false;
  21. }
  22. public IDisposable Subscribe(IObserver<T> observer)
  23. {
  24. return Disposable.Empty;
  25. }
  26. }
  27. }