Microsoft net 5.1 Being Objects and A glimpse into Coding Pan Wuming 2017
Microsoft .NET 5.1 Being Objects and A Glimpse into Coding Pan Wuming 2017
opICS Sematic Conformity: Object Class Comparisons Between Objects To Overload the equality operator To Override the GetHashCode method To Override the tostring method Memberwise clone method The getty )e method References Object Class(MSDN) C# Operators( MSDN) Hash function(Wikipedia)
Topics • Sematic Conformity: Object Class • Comparisons Between Objects • To Overload the Equality operator • To Override The GetHashCode Method • To Override The ToString Method • MemberwiseClone Method • The GetType Method References: Object Class(MSDN) C# Operators(MSDN) Hash function (Wikipedia)
Sematic Conformity: Object Class The ultimate base class of all classes in the net framework To provides ou.laval carica ta darian claccac. Languages The root of the type hierarchy eritance from Object The inheritance is implicit
Sematic Conformity: Object Class • The ultimate base class of all classes in the .NET Framework. • To provides low-level services to derived classes. • Languages typically do not require a class to declare inheritance from Object. The root of the type hierarchy The inheritance is implicit
67 namespace leaching lass Aclass .. public class Object #egon程序集 mscorlib. version400 Culture=neutral PublicKey Token=b77a 5c561934e089 bjB) //C: Program Files(x86)\Reference assemblies \Microsoft\ Framework \.NETFramework v40 mscorlib. dll .pu #eregion proL Find All Reterences Shift+F12
The Definition of Object Class From metadata of #region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // C:\Program Files (x86)\Reference Assemblies \Microsoft\Framework \.NETFramework\v4.0\mscorlib.dll #endregion
Derived classes can override these methods equals Finalize e GetHash Code ToString
Derived classes can override these methods: • Equals • Finalize • GetHashCode • ToString