Skip to main content
C# / .NET Output Prediction Medium +20 XP

String Comparison

What does this return?

C# / .NETRead-only
string a = "Hello";
string b = "hello";
Console.WriteLine(a.Equals(b, StringComparison.OrdinalIgnoreCase));

What is the output?

Show answer and explanation

Answer: True

StringComparison.OrdinalIgnoreCase compares strings ignoring case. 'Hello' and 'hello' are equal under this comparison.

Hint: OrdinalIgnoreCase ignores letter casing.

What this challenge tests

Output Prediction in C# / .NET: strings, comparison.

Related challenges