/// <summary> /// Removes the subscription from the state. /// </summary> /// <param name="subscription">The subscription to remove</param> /// <seealso cref="StateSubscription"/> public void RemoveSubscription(StateSubscription subscription) { subscriptions.Remove(subscription); if (subscription.Active) { subscription.Unsubscribe(); } }
/// <summary> /// Adds the subscription to the state. /// </summary> /// <param name="subscription">The subscription to add.</param> /// <param name="subscribe">If set to <c>true</c> subscription is automatically subscribed.</param> /// <seealso cref="StateSubscription"/> public void AddSubscription(StateSubscription subscription, bool subscribe = false) { subscriptions.Add(subscription); if (subscribe) { subscription.Subscribe(); } }