Collapse AllExpand All      Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: F# Code: JScript 
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.

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

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
<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.

  NameDescription
Public method ObjectInitializes a new instance of the Object class.
Top
  NameDescription
Public method Equals(Object)Determines whether the specified Object is equal to the current Object.
Public method Static member Equals(Object, Object)Determines whether the specified object instances are considered equal.
Protected method FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
Public method GetHashCodeServes as a hash function for a particular type.
Public method GetTypeGets the Type of the current instance.
Protected method MemberwiseCloneCreates a shallow copy of the current Object.
Public method Static member ReferenceEqualsDetermines whether the specified Object instances are the same instance.
Public method ToStringReturns a string that represents the current object.
Top

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.

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