In. NET, the base class for all built-in types is System.Object. What is included in the System.Object class is often the subject of the interview. System.Object contains 8 methods, including Finalize, with 3 virtual methods: The Equals, GetHashCode, and ToString methods. When designing a type, you might consider overriding the Equals method when you need to make a content comparison of the type object, and only consider overriding the GetHashCode method when the type will be used as the container's key value, and most types should consider overriding the ToString method. The following is a list of System.Object methods:
| Public instance methods |
Brief description |
| Virtual bool Equals (object obj) |
Determines whether two objects are equal, Equals returns True, and is not equal returns false |
| Virtual bool GetHashCode () |
Returns a hash code for this object |
| Type GetType () |
Returns the type of the current object |
| Virtual string ToString () |
Returns a string that can represent the current object, in which the method returns the full name of the current object type System.Object |
| public static methods |
Brief description |
| BOOL Equals (Object Obja,object OBJB) |
Determines whether two objects are equal, Equals returns True, and is not equal returns false |
| BOOL ReferenceEquals (Object Obja,object OBJB) |
Compares references to two objects for equality, returns true for equality, and returns false for equality |
| Protected instance method |
Brief description |
| Object MemberwiseClone () |
Shallow copy the current object instance and returns a reference to the copied object |
| Finalize |
. Net-destructor method |
The basic method of object default in. Net