C# Dictionary<> and mutable keys
        Posted  
        
            by Pierreten
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Pierreten
        
        
        
        Published on 2010-06-09T15:30:43Z
        Indexed on 
            2010/06/09
            15:32 UTC
        
        
        Read the original article
        Hit count: 247
        
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?
© Stack Overflow or respective owner