Method to add new or update existing item in C# Dictionary

Could there be any problem if i replace Method-1 by Method-2? No, just use map[key] = value. The two options are equivalent. Regarding Dictionary<> vs. Hashtable: When you start Reflector, you see that the indexer setters of both classes call this.Insert(key, value, add: false); and the add parameter is responsible for throwing an exception, when … Read more