I will like to ask this question, but I don't know if is beyond the scope of this learning. it's about Gethashcode (), Tostring () Gettype () etc. I will like a little enligthment. The definition and overriding in a class, though I have gotten some definition, but I will like if someone could throw more light on it's usage. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I will like to ask this question, but I don't know if is beyond the scope of this learning. it's about Gethashcode (), Tostring () Gettype () etc. I will like a little enligthment. The definition and overriding in a class, though I have gotten some definition, but I will like if someone could throw more light on it's usage.

31st Oct 2016, 1:39 PM
Walter Eke
2 Answers
0
You are going to want to read this section of MSDN to answer most of your questions. https://msdn.microsoft.com/en-us/library/system.object(v=vs.110).aspx To answer your specific questions: GetHashCode() is a way for your object to be identified in a Dictionary or HashTable. Basically its a way to shortcut equality instead of comparing the values in the object the numeric values are compared to determine equality. A good hashing algorithm is important to insure that 2 different objects don't end up with the same hashcode. "Object.GetHashCode Method ()" - https://msdn.microsoft.com/en-us/library/system.object.gethashcode(v=vs.110).aspx ToString() is implemented so a class can be displayed somewhere. The default implementation is to return the fully-qualified type name. "Object.ToString Method ()" - https://msdn.microsoft.com/en-us/library/system.object.tostring%28v=vs.110%29.aspx GetType() returns a Type object which represents the instance type. "Object.GetType Method ()" - https://msdn.microsoft.com/en-us/library/system.object.gettype(v=vs.110).aspx
4th Nov 2016, 2:01 PM
Michael Dolence
0
Thank's this is very helpfull
4th Nov 2016, 5:19 PM
Walter Eke