pla-01/Life/Misc/DelegateSubscriber.cs
2019-10-26 16:47:08 +02:00

26 lines
493 B
C#

using System;
namespace Life.Misc
{
public class DelegateSubscriber<T> : IObserver<T>
{
public Action<T> Action;
public Action<Exception> Error;
public Action Completed;
public void OnCompleted()
{
Completed?.Invoke();
}
public void OnError(Exception error)
{
Error?.Invoke(error);
}
public void OnNext(T value)
{
Action?.Invoke(value);
}
}
}