Object Class
SystemRepresents 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
Name | Description |
---|---|
Determines whether the specified Object is equal to the current Object. | |
Indicates whether the specified objects are equal. | |
GetType() |
Gets the Type of the current instance. |
Serves as the default hash function. | |
ReferenceEquals(object objA, object objB) |
Determines whether the specified Object instances are the same instance. |
ToString() |
Returns a string that represents the current object. |
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
andReferenceEquals
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.