Browse Source

Merge pull request #10105 from AvaloniaUI/reactive-alternative

Make AnonymousObserver public and LightweightObservableBase internal
pull/10160/head
Nikita Tsukanov 3 years ago
committed by GitHub
parent
commit
c49b8c301a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/Avalonia.Base/Reactive/AnonymousObserver.cs
  2. 2
      src/Avalonia.Base/Reactive/LightweightObservableBase.cs

7
src/Avalonia.Base/Reactive/AnonymousObserver.cs

@ -1,9 +1,14 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Avalonia.Reactive;
internal class AnonymousObserver<T> : IObserver<T>
/// <summary>
/// Class to create an <see cref="IObserver{T}"/> instance from delegate-based implementations of the On* methods.
/// </summary>
/// <typeparam name="T">The type of the elements in the sequence.</typeparam>
public class AnonymousObserver<T> : IObserver<T>
{
private static readonly Action<Exception> ThrowsOnError = ex => throw ex;
private static readonly Action NoOpCompleted = () => { };

2
src/Avalonia.Base/Reactive/LightweightObservableBase.cs

@ -14,7 +14,7 @@ namespace Avalonia.Reactive
/// usage. This class provides a more lightweight base for some internal observable types
/// in the Avalonia framework.
/// </remarks>
public abstract class LightweightObservableBase<T> : IObservable<T>
internal abstract class LightweightObservableBase<T> : IObservable<T>
{
private Exception? _error;
private List<IObserver<T>>? _observers = new List<IObserver<T>>();

Loading…
Cancel
Save