C# Dictionary<> and mutable keys
问题 I was told that one of the many reasons strings were made immutable in the C# spec was to avoid the issue of HashTables having keys changed when references to the string keys altered their content. The Dictionary<> type allows reference types to be used as a key. How does the dictionary avoid the issue of altered keys that lead to "misplaced" values? Is there a memberwise clone made of an object when used as a key? 回答1: The Dictionary<TKey,TValue> type makes no attempt to protect against the