[Mono-bugs] [Bug 73417][Nor] Changed - Array.Sort() does not sort correctly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 28 Apr 2005 23:55:49 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=73417

--- shadow/73417	2005-04-28 19:33:20.000000000 -0400
+++ shadow/73417.tmp.5804	2005-04-28 23:55:49.000000000 -0400
@@ -159,6 +159,21 @@
 which the array was sorted, the split search fails.
 
 This may be related to bug 61458, which dealt with a very similar 
 problem. Can you think of any workaround that would work for 
 both .NET and Mono? At the moment, I'm doing a linear search in order 
 to keep the generated code portable, but that's rather inefficient.
+
+------- Additional Comments From atsushi@ximian.com  2005-04-28 23:55 -------
+Oops, sorry your code specified DefaultInvariant which won't be
+culture dependent. But anyways I don't recommend to use it since there
+are some strings that are regarded as equivalent under that condition
+e.g. "\u00E0" and "ae". Furthermore, there are many characters that
+are "ignored". For example if you have Cherokee character in the
+string, the character will be just ignored and result in unexpected
+equality.
+
+I recommend to implement your own IComparer whose Compare() uses
+String.CompareOrdinal() and pass it to Array.Sort(). If you need case
+insensitive results, it is still not so difficult to implement
+String.CompareOrdinal() which uses char.ToLower(invariant_culture) by
+yourself.