Here Is When HashSet & Dictionary Call GetHashCode and Equals

preview_player
Показать описание

In this video, we will inspect behavior of the HashSet generic type in C# and investigate in which moments it is using the result of GetHashCode, and in which the result of calling the Equals method on objects added to the data structure.

We will clarify that hash code of an object is used to determine the location in the data structure where to store the object, or where to search for it on request. Contrary to that, the Equals method is only invoked after a colliding hash code is discovered.

We will repeat the same experiment with the Dictionary generic class, coming to the same conclusions.

Learn more from video courses:

Other videos on this channel you may be interested in watching:
Рекомендации по теме
Комментарии
Автор

What a great, straightforward explanation. Thank you.

rhornjr
Автор

Thanks a lot for this video and all the others you shared, Zoran! Its always a pleasure to watch your tutorials, because you have a very concise way of explaining even difficult topics.

liviu_o
Автор

Excelente ejemplo de como trabaja el código Hash, muchas gracias por este valioso aporte.

Darebitk
visit shbcf.ru