[Mono-devel-list] Patch idea for previous message

Kornél Pál kornelpal at hotmail.com
Tue Jun 7 05:33:06 EDT 2005

> No, you aren't aware of the whole problem.

You may be right.:)
By now I have understood what your problem is.

> String comparison with
> invariant culture does not mean that it has no other side effect
> than case insensitivity. With CultureInfo dependent (including
> InvariantCulture) there are some characters that are ignored in the
> comparison (and sometimes culture-sensitive comparison is buggy, at
> least with MS.NET) or regarded equivalent to other character
> sequences.

It's true but I don't treat this as a bug I think it is the expected
>From String.Compare documentation in .NET Framework SDK:

The comparison uses the current culture to obtain culture-specific
information such as casing rules and the alphabetic order of individual
characters. For example, a culture could specify that certain combinations
of characters be treated as a single character, or uppercase and lowercase
characters be compared in a particular way, or that the sorting order of a
character depends on the characters that precede or follow it.

And even InvarianCulture can have such rules the only thing is guaranted
that it allways has the same rules.

.NET Framework 2.0 has a new option: OrdinalIgnoreCase
It does exactly what you want.

As it does not exists in 1.x I agree that the only solution is to use
ToLower along with CompareOrdinal that should have the same result as
OrdinalIgnoreCase but has some performance penalties.


More information about the Mono-devel-list mailing list