Avatar ·

Difference between == and === in C#

Hello everyone! I'm new to C# (previously wrote in JavaScript) and encountered confusion with comparison operators. In JS there is strict comparison === and non-strict ==. In C# I only see ==, but I've heard there are Equals() and ReferenceEquals(). However, I can't find information about === — does it simply not exist? Or is it some syntax I missed?

\n\n

I tried the following code:

\n
int a = 5;\nint b = 5;\nobject objA = a;\nobject objB = b;\n\nConsole.WriteLine(a == b);          // True\nConsole.WriteLine(objA == objB);    // False (reference comparison?)\nConsole.WriteLine(objA.Equals(objB)); // True (value comparison?)\n
\n\n

I expected objA == objB to give True, but got