Given record Point(int X, int Y);, what does Console.WriteLine(new Point(1, 2) == new Point(1, 2)); print?
Correct answer A. True
Explanation
Records have compiler-generated value-based equality: two instances are equal when they are the same type and all their properties are equal. So the two Point objects compare equal and the program prints True, even though they are separate objects. An ordinary class would use reference equality and print False. Records also generate a readable ToString.
Answer checked How we write and check questions
Discussion