Case-Insensitive String Comparison not working in C#?

Posted by SB2055 on Stack Overflow See other posts from Stack Overflow or by SB2055
Published on 2013-10-26T03:49:41Z Indexed on 2013/10/26 3:54 UTC
Read the original article Hit count: 394

Filed under:
|
|
|

Based on the answer to this question:

C# Case insensitive string compare

I'm trying to do a case-insensitive comparison without using Compare or ToLower:

var user = db.Users.FirstOrDefault(s => String.Equals(s.Username, username, StringComparison.OrdinalIgnoreCase));

However I get an error:

Incorrect number of arguments supplied for call to method 'Boolean Equals(System.String, System.String, System.StringComparison)'

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET