mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-23 00:28:23 -05:00
26 lines
616 B
C#
26 lines
616 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UnityAtoms
|
|
{
|
|
public class ObservableUnsubscriber<T> : IDisposable
|
|
{
|
|
private List<IObserver<T>> _observers;
|
|
private IObserver<T> _observer;
|
|
|
|
public ObservableUnsubscriber(List<IObserver<T>> observers, IObserver<T> observer)
|
|
{
|
|
this._observers = observers;
|
|
this._observer = observer;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (_observer != null && _observers.Contains(_observer))
|
|
{
|
|
_observers.Remove(_observer);
|
|
}
|
|
}
|
|
}
|
|
}
|