-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String IgnoreCase extension method #30626
Comments
Duplicate of https://github.com/dotnet/corefx/issues/649? |
I don't understand what you mean by "you can alter it by passing a StringComparison Enum". Does that mean that your proposed EqualsIgnoreCase should accept StringComparison as the second parameter? at that point might as well as just use the existing Equals method. |
@Gnbrkm41 I edited the title to make it more understandable. |
So, are you suggesting that your suggestion would be used like: str1.EqualsIgnoreCase(str2, StringComparison.Ordinal) and it's better than str1.Equals(str2, StringComparison.OrdinalIgnoreCase) ? |
@Gnbrkm41 in most cases it will be str1.EqualsIgnoreCase(str2) and that is more straightforward than str1.Equals(str2, StringComparison.OrdinalIgnoreCase) |
p.s: if we're going to add this as an instance method, I think #14065 suits better. |
|
How about to split the Equals String extension method in 2
Equals()
andEqualsIgnoreCase()
each should a have a default behavior and accepts a new Comparison Enum like the StringComparison Enum that has only 3 values
as a parameter (like
Equals()
now)I think it will make it easier to use for most cases (and more likely to be noticed with an IDE )
The text was updated successfully, but these errors were encountered: