public bool UnRegisterSubject(INotificationSubject unRegisterFrom) { if (unRegisterFrom.UnregisterObserver(this)) { if (subjects.TryRemove(unRegisterFrom.GetGuid(), out INotificationSubject removed)) { return(removed.GetGuid().Equals(unRegisterFrom.GetGuid())); } } return(false); }
public bool RegisterSubject(INotificationSubject registerTo) { if (registerTo.RegisterObserver(this)) { if (subjects.TryAdd(registerTo.GetGuid(), registerTo)) { return(true); } } return(false); }