11 February 2014

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

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.

No comments:

Post a Comment