public void RemoveObserver(IObserver <T> observer) { PriorityObserver <T> obs = null; foreach (var observerPair in m_observers) { if (observerPair.Observer == observer) { obs = observerPair; break; } } if (obs != null) { m_observers.Remove(obs); } }
public int Compare(PriorityObserver <T> x, PriorityObserver <T> y) { if (x.Observer != y.Observer) { if (x.Priority > y.Priority) { return(1); } else if (x.Priority < y.Priority) { return(-1); } else if (x.Priority == y.Priority) { return(1); } } return(0); }