26 lines
493 B
C#
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);
|
|
}
|
|
}
|
|
} |