String.Equals with OrdinalIgnoreCase compared to ToLower / ToUpper for string insensitive comparisons in C#

In C#, when checking if strings are equal in a case insensitive way prefer string.Equals with OrdinalIgnoreCase over using ToLower() … Continue reading String.Equals with OrdinalIgnoreCase compared to ToLower / ToUpper for string insensitive comparisons in C#

Benchmark custom code workarounds against each new version of .NET as the framework gets faster all the time

Always revisit and benchmark your custom code workarounds with each version of .NET. The .NET framework and the JIT compiler gets faster … Continue reading Benchmark custom code workarounds against each new version of .NET as the framework gets faster all the time

Regular Expressions using RegexOptions.IgnoreCase slower than inline case insensitive pattern syntax in .NET 6

RegexOptions.IgnoreCase often offers better readability and expression of intent than inline pattern matching. We can see examples of the two … Continue reading Regular Expressions using RegexOptions.IgnoreCase slower than inline case insensitive pattern syntax in .NET 6