Windows apps
Collapse the table of content
Expand the table of content

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

The Object type exposes the following members.

  NameDescription
Public methodObjectInitializes a new instance of the Object class.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object.
Public methodStatic memberEquals(Object, Object)Determines whether the specified object instances are considered equal.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
Public methodGetHashCodeServes as a hash function for a particular type.
Public methodGetTypeGets the Type of the current instance.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
Public methodStatic memberReferenceEqualsDetermines whether the specified Object instances are the same instance.
Public methodToStringReturns 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.

Show:
© 2017 Microsoft