Beginner
C#
Q25 / 100
What is the difference between == and .Equals() for strings in C#?
Correct! Well done.
Incorrect.
The correct answer is B) For string, both check value equality because == is overloaded. Generally, == checks reference for objects
B
Correct Answer
For string, both check value equality because == is overloaded. Generally, == checks reference for objects
Explanation
For string specifically, C# overloads == to compare values. For general objects, == compares references. Use string.Equals(a, b, StringComparison) for culture-aware comparison.
Progress
25/100