Tuesday, July 13, 2004 5:21 PM
pgolde
bool return values
The “AddOrUpdate” and “FindOrAdd” methods both return a bool that indicates which operation ended up being beformed (Add vs Update, Find vs. Add). That leaves the question, which should be true and which should be false? How will people remember easily?
The solution I've settled on (for now), is that all the bool returning methods return “true” if the key was in the dictionary when the method call was made, “false” if the key was not in the dictionary. This applies to:
AddOrUpdate, FindOrAdd, TryGetValue, Remove, and ContainsKey.