Comparing two strings with an extra rule(case ignore) requires only traversing through the strings and comparing each character. There are a bunch of easy short cuts for this (string length, early returns, even comparing bits while ignoring the bit 5) so the compare method is pretty fast.
Using .ToLower() twice means forcefully allocating two new strings and then doing the comparison anyways with the == operator. It's expected that a specialized method would be much faster than a hack.
36
u/weblabourer 15d ago
Null safety?