Different ways of adding to a dictionary in C#
The performance is almost a 100% identical. You can check this out by opening the class in Reflector.net This is the This indexer: public TValue this[TKey key] { get { int index = this.FindEntry(key); if (index >= 0) { return this.entries[index].value; } ThrowHelper.ThrowKeyNotFoundException(); return default(TValue); } set { this.Insert(key, value, false); } } And this … Read more