Compare Equals(==,Equal()) in C#
This link Contents Introduction Point 1 :- Comparison on the basis of Equality Scenario 1:- Value type comparison Scenario 2:- Reference types comparison Scenario 3:- String comparison, interning and object type casting Point 2 :- Compile time VS RunTime Point 3 :- The NULL Situation When to use what :- Technical comparison VS Semantical comparison The Full Picture Introduction To compare equality between variables C# has provided two ways of doing comparison “==” and an overloaded method “equals()”. Most of the developers use “==” and “Equals” is hardly discussed. So in this small note we will discuss about differences between them and when to use what. Point 1 :- Comparison on the basis of Equality Answering to the point “There is no difference between equality comparison using “==” and “Equals()”, except when you are comparing “String” comparison. The common comparison Rule :-Whenever youare comparing variables they are either value types or reference types.