Skip to main content
C# / .NET Output Prediction Hard +35 XP

Record Equality

What does this print?

C# / .NETRead-only
record Point(int X, int Y);
var p1 = new Point(1, 2);
var p2 = new Point(1, 2);
Console.WriteLine(p1 == p2);

What is the output?

Show answer and explanation

Answer: True

C# records use value-based equality by default. Two records with the same property values are considered equal.

Hint: Records compare by value, not reference.

What this challenge tests

Output Prediction in C# / .NET: records, equality.

Related challenges