Home > Interview Questions > C#.NET > What is the difference between a==b and a.Equals(b) in C#.NET?

What is the difference between a==b and a.Equals(b) in C#.NET?

by Raja   on 24/05/2011   Category: C#.NET   |  Level: Intermediate   |  Views: 2156    |  Points: 25     |  Bronze 


Both Equals and == used to comparison and returns the Boolean. Equals is used to compare between two objects means that it compares the values they are having but a== b is used to compare the references.

Equals will be used to compare even a & b contains different data type but if you use == in this case you will get compile time error.


« How do you handle exceptions without using try catch blocks in asp.net?
» list of access specifiers available in c#.net ?
Post Question  |  Question Home

Recent Posts

User Responses


No response found, be the first to review this question.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts