Monday, 25 September 2017

Object Class in .NET


  • Object class supports all classes in the .NET framework class hierarchy.
  • Provide low level services to derived classes.
  • It is the root of the type hierarchy.


The object class has following methods:

1) Equals(Object): Determines whether the specified object is equal to the current object.

2) GetType(): Get the type of the current instance OR returns type of the object.

3) ReferenceEquals(): Determines whether the specified object instances are the same instance.

4) ToString(): Converts an instance to a string type.

5) GetHashCode(): Returns hashcode for an object OR serves as the default has function.

6) MemberwiseClone(): Creates a shallow copy of the current object.

7) Finalize(): Allows an object to try to free resources & perform other cleanup operations before it is reclaimed by garbage collection.

-Derived classes can & do override some of these methods like equals, finalize, GetHashCode, ToString.


No comments:

Post a Comment