public void EraseSubTopics( string topic, TopicSubscriberList subs, TopicBrokerList bros ) { string matchTopic = topic.Substring( 0, topic.Count() - 1 ); HashSet<string> existingSubTopics = new HashSet<string>(); foreach ( var pubEntry in dictionary ) { foreach ( string iTopic in pubEntry.Value.GetListTopics() ) { if ( iTopic.StartsWith( matchTopic ) ) { existingSubTopics.Add( iTopic ); } } } foreach ( string matchingTopic in existingSubTopics ) { if ( subs.HowManySubscribed( matchingTopic ) + bros.HowManySubscribed( matchingTopic ) == 0 ) { EraseTopic( matchingTopic ); } } }
public void EraseSubTopics(string topic, TopicSubscriberList subs, TopicBrokerList bros) { string matchTopic = topic.Substring(0, topic.Count() - 1); HashSet <string> existingSubTopics = new HashSet <string>(); foreach (var pubEntry in dictionary) { foreach (string iTopic in pubEntry.Value.GetListTopics()) { if (iTopic.StartsWith(matchTopic)) { existingSubTopics.Add(iTopic); } } } foreach (string matchingTopic in existingSubTopics) { if (subs.HowManySubscribed(matchingTopic) + bros.HowManySubscribed(matchingTopic) == 0) { EraseTopic(matchingTopic); } } }