[Mono-list] String comparisons slow

Michael Hutchinson m.j.hutchinson at gmail.com
Wed Jul 21 16:28:44 EDT 2010


On Wed, Jul 21, 2010 at 3:30 PM, David S <buttink at gmail.com> wrote:
> Ok. Now I'm confused. How come "CurrentCulture" for US/ENG doesn't just run
> the Ordinal??? Perhaps there are some weird alphabetizing things I just
> don't understand. BTW, Thanks for tell us about the StringComparer class. I
> never knew that existed.

Note also that some string methods have overloads for taking specific
cultures, or the StringComparison enum. Both StringComparison.Ordinal
and StringComparison.OrdinalIgnoreCase (as well as StringComparer) can
be very useful to improve performance when culture-dependent behaviour
is not needed or desirable.

Culture-dependent string comparisons are a very complex topic. There's
also an "invariant" culture for doing things in a culture-independent
way.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Mono-list mailing list