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.
2 ответов
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
0
Thank's this is very helpfull