Represents the base class for all types in the .NET Framework, providing fundamental methods and properties that are available to all objects.

Summary

The Object class is the ultimate base class of all types in the .NET Framework. It is the root of the type hierarchy. Every type, whether it is a value type or a reference type, is a direct or indirect descendant of the Object class. Every type in the .NET Framework is a member of the Object class.

Members

Methods

Public Methods
Name Description
Determines whether the specified Object is equal to the current Object.
Equals(object objA, object objB)
Indicates whether the specified objects are equal.
Gets the Type of the current instance.
Serves as the default hash function.
Determines whether the specified Object instances are the same instance.
Returns a string that represents the current object.

Fields

Public Static Fields
Name Description
null
Represents a null reference.

Remarks

The Object class provides the following capabilities:

  • Type Information: Methods like GetType allow you to inspect the runtime type of an object.
  • Equality Comparison: Methods like Equals and ReferenceEquals enable comparing objects for equality, either by value or by reference.
  • Hashing: The GetHashCode method provides a hash code for an object, which is useful for data structures like hash tables.
  • String Representation: The ToString method allows for a human-readable string representation of an object.
  • Object Identity: All objects inherit the identity of the Object class, ensuring a consistent foundation for all types.

Most classes in the .NET Framework inherit directly or indirectly from the Object class. When you create a new class without specifying a base class, it implicitly inherits from Object.

For more detailed information, refer to the official Microsoft documentation.