Share via


Object Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.

Inheritance Hierarchy

System..::..Object
  All classes, structures, enumerations, and delegates.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class Object
[SerializableAttribute]
public class Object
[SerializableAttribute]
public ref class Object
[<SerializableAttribute>]
type Object =  class end
public class Object

The Object type exposes the following members.

Constructors

  Name Description
Public method Object Initializes a new instance of the Object class.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object.
Public methodStatic member Equals(Object, Object) Determines whether the specified object instances are considered equal.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
Public method GetHashCode Serves as a hash function for a particular type.
Public method GetType Gets the Type of the current instance.
Protected method MemberwiseClone Creates a shallow copy of the current Object.
Public methodStatic member ReferenceEquals Determines whether the specified Object instances are the same instance.
Public method ToString Returns a string that represents the current object.

Top

Remarks

Languages typically do not require a class to declare inheritance from Object because the inheritance is implicit.

Because all classes in the .NET Framework are derived from Object, every method defined in the Object class is available in all objects in the system. Derived classes can and do override some of these methods, including:

  • Equals - Supports comparisons between objects.

  • Finalize - Performs cleanup operations before an object is automatically reclaimed.

  • GetHashCode - Generates a number corresponding to the value of the object to support the use of a hash table.

  • ToString - Manufactures a human-readable text string that describes an instance of the class.

Thread Safety

Public static (Shared in Visual Basic) members of this type are thread safe. Instance members are not guaranteed to be thread-safe.

See Also

Reference

System Namespace