Add stock example on Observer pattern

This commit is contained in:
Petrutiu Mihai
2016-06-28 17:26:33 +03:00
parent 4a69b3da17
commit 5d639bf0ab
13 changed files with 262 additions and 34 deletions

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ObserverPattern
{
public class Unsubscriber<T> : IDisposable
{
private List<IObserver<T>> _observers;
private IObserver<T> _observer;
public Unsubscriber(List<IObserver<T>> observers, IObserver<T> observer)
{
_observers = observers;
_observer = observer;
}
public void Dispose()
{
if (!(_observer == null)) _observers.Remove(_observer);
}
}
}