I have a question which might look silly. Is there any specific reason behind defining methods like ToStrin(),GetHashCode(),GetType() etc on the base Object Type . Are these methods internally be used by the .Net framework for any purpose. Just curious to know the thoughts that have been behind this design.
Thanks,
sveerap
These methods were considered the bare minimum required by all objects. By introducing them to the
System.Objectclass, they are available on all objects within .NET.Each serves a purpose:
EqualsandReferenceEqualsare used for equality checkingGetHashCodeallows objects to be used in hashed collectionsGetTypeis required for reflection to workToStringallows all objects, regardless of type, to be represented in a string form, which is incredibly usefulFinalizeallows resources to be handled properly by the garbage collectorMemberwiseCloneallows for shallow copies of objects to be generated