Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Intermediate C#!
You have completed Intermediate C#!
Preview
When overriding Object.Equals we should also override Object.GetHashCode. Here's why and how.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
TreehouseDefense.Point overrides
Object.Equals but
0:00
it does not override Object.GetHashCode.
0:02
The hash code of an object is an integer
that is unique to that object.
0:06
Different objects will
have different hash codes.
0:10
Every object created is
given a unique identifier.
0:13
So by default,
this ID is used as an object's hash code.
0:15
This ID, if you will,
is actually just its memory address.
0:20
Being able to identify an object
by its hash code is very handy and
0:24
the GetHashCode method is used
by many C# collection types.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up