Different between equality operator (==) and equals() methods in C#
Loading
Different between equality operator (==) and equals() methods in C#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Nov 10, 2022, 5:55 AM
https://www.c-sharpcorner.com/Blogs/difference-between-operator-and-equals-method
NitinPosted Nov 10, 2022, 5:34 AM
https://www.c-sharpcorner.com/UploadFile/3d39b4/difference-between-operator-and-equals-method-in-C-Sharp/
Abhishek SinghalPosted Nov 10, 2022, 4:50 AM
Hi Naresh,
equals() method compare the content of two string whereas the == operator checks the reference of the string object.
Please look at the below example
The Output will be :
True
False
True
Brahma Prakash ShuklaPosted Nov 9, 2022, 6:11 PM
The Equality Operator ( ==) is the comparison operator and the Equals() method in C# is used to compare the content of a string.
The Equals() method compares only content.