Important Methods of System.Object Class in C#

1. Equals():


    Public virtual bool Equals(){}

This method is used to compare the state of object not the reference of object.

2. Finalize()


    Protected virtual void finalize(){}

This methodallows an object toattempt to free resources and perform other clean up operation
Before the object is reclaimed by garbage collector

3. GetHashcode():


    Public virtual int Gethashcode(){}

Hash code is calculated by looking towards the state of the object

4. GetType():


    Public Type gettype(0{]

We can say it is the same as GetClas() in JAVA.

We can Get the type of current object.

5. MemberwiseClone():


    Protected object MemberwiseClone(){]

If you Remember shallow Copy,It creates the Shallow copy of the Current Object.

6. ReferenceEquals():


    Public static bool ReferenceEquals(object obj1,object obj2){}

It determines Whether the References of two Object IIS Same or Not.

7 ToString():


It is the Most Familiar Method.

    Public virtual string ToString(){}

It represent The current Object In String format.

Object Class Always on sist of parameter less onstrutor.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now