Why GetHashCode is in Object class?

前端 未结 7 1593
故里飘歌
故里飘歌 2021-01-04 20:57

Why GetHashCode is part of the Object class? Only small part of the objects of the classes are used as keys in hash tables. Wouldn\'t it be better to have a separate interfa

7条回答
  •  心在旅途
    2021-01-04 21:27

    It allows any object to be used as a key by "identity". This is beneficial in some cases, and harmful in none. So, why not?

提交回复
热议问题