Junior — Middle
Can you name the main methods available in the Object class object?
sobes.tech AI
Answer from AI
In C#, the Object class is the base for all types and provides several key methods:
Equals(object obj)— checks if the current object is equal to another.GetHashCode()— returns the hash code of the object, used in collections.ToString()— returns a string representation of the object.GetType()— returns the type of the current instance.MemberwiseClone()— creates a shallow copy of the object (protected method).Finalize()— called before garbage collection to clean up resources (usually via destructor).
Example usage:
object obj = new object();
Console.WriteLine(obj.ToString());
Console.WriteLine(obj.GetHashCode());
Console.WriteLine(obj.GetType());