.net - Is it "bad" to use objects as Keys in dictionaries? -


i assume when doing look-up in dictionary needs hash key giving , use hash find object looking for.

if so, using larger objects keys slow down look-up or have other consequences not encountered using string or simple data type key?

yes, it's bad idea use mutable object dictionary key.

taking @ https://stackoverflow.com/a/7941876/400760, leads me believe there unintended consequences, correctly implemented gethashcode() based on how hash based collections typically implemented.

it should safe use immutable object dictionary key.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -