}//end RemoveInterests(UserInterests) /// <summary> /// Removes a single interest from the list, works by deducting the amount of occurances, if that number becomes zero, remove the interest entirely /// </summary> /// <param name="InterestIn"> the interest to search for </param> public void RemoveInterest(UserInterest InterestIn) { if (Interests.ContainsKey(InterestIn)) { Interests[InterestIn]--; if (Interests[InterestIn] == 0) { Interests.Remove(InterestIn); } } }//end RemoveInterest(UserInterest)
}//end AddInterests(UserInterests) /// <summary> /// Adds a single interest to the dictionary, if the interest already exists inc the key, if not, add it to the dictionary /// </summary> /// <param name="InterestIn"> The interest to search for </param> public void AddInterest(UserInterest InterestIn) { if (Interests.ContainsKey(InterestIn)) { Interests[InterestIn]++; } else { Interests.Add(InterestIn, 1); } }//end AddInterest(InterestIn)
}//end RemoveInterest(UserInterest) public int GetValue(UserInterest InterestIn) { return(Interests[InterestIn]); }//end GetKey(UserInterest)
}//end Process() #region List Methods /// <summary> /// Performs a binary search on the Interests list /// </summary> /// <param name="InterestsIn"> The Interest that we're searching for </param> /// <returns> The indexed position of the Interests or a negative number if nothing found </returns> public int SearchInterests(UserInterest InterestIn) { return(this.Interests.BinarySearch(InterestIn)); }//end SearchInterests(Interests)
}//end Add(UserInterest) public void Remove(UserInterest InterestIn) { this.Interests.Remove(InterestIn); }//end Remove(UserInterest)
}//end SortInterests() public void Add(UserInterest InterestIn) { this.Interests.Add(InterestIn); }//end Add(UserInterest)