/// <summary> /// Checks if there are subscribers for a certain type of events /// </summary> /// <returns><c>true</c>, if exists was subscriptioned, <c>false</c> otherwise.</returns> /// <param name="type">Type.</param> /// <param name="receiver">Receiver.</param> private static bool SubscriptionExists(Type type, MMEventListenerBase receiver) { List <MMEventListenerBase> receivers; if (!_subscribersList.TryGetValue(type, out receivers)) { return(false); } bool exists = false; foreach (MMEventListenerBase subscription in receivers) { if (subscription == receiver) { exists = true; break; } } return(exists); }
/// <summary> /// Checks if there are subscribers for a certain type of events /// </summary> /// <returns><c>true</c>, if exists was subscriptioned, <c>false</c> otherwise.</returns> /// <param name="type">Type.</param> /// <param name="receiver">Receiver.</param> private static bool SubscriptionExists(Type type, MMEventListenerBase receiver) { List <MMEventListenerBase> receivers; if (!_subscribersList.TryGetValue(type, out receivers)) { return(false); } bool exists = false; for (int i = receivers.Count - 1; i >= 0; i--) { if (receivers[i] == receiver) { exists = true; break; } } return(exists); }