Provide a string.Equals(StringComparison.OrdinalIgnoreCase) equivalent operator #4117
Replies: 4 comments
-
Why is this case so important that it requires a special operator? |
Beta Was this translation helpful? Give feedback.
-
You can write an extension method for this to save typing. |
Beta Was this translation helpful? Give feedback.
-
Or a wrapper |
Beta Was this translation helpful? Give feedback.
-
In most (in fact, the vast majority of) cases where I initially end up writing code like this:
it's because there's a semantic type that needs to be explicitly identified - in this example Pull that out as a struct (as it's a value type) and you can override
Moreover, you gain certainty that everywhere you compare two CustomerIds, you are doing so the same way. (Not to mention the type safety of not confusing a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I hope this code:
can replaced by:
may be other like:
~~
,=~
,=:=
Beta Was this translation helpful? Give feedback.
All reactions