Which is generally best to use — StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?

I have some code like this:

If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
    DoSomething()
End If

I don’t care about the case. Should I use OrdinalIgnoreCase, InvariantCultureIgnoreCase, or CurrentCultureIgnoreCase?

5 Answers
5

Leave a Comment