[Mono-list] arraylist.sort unstable ?

andreas graeper agraeper at googlemail.com
Tue May 13 20:31:01 UTC 2014


i am learning collections / generics ..
and found an example defining a class Cmp that implements IComparer using
CaseInsensitiveComparer

ArrayList l = new ArrayList();
l.Add("a");
l.Add("A");

l.Sort(new Cmp()); lprint(l);
l.Sort(new CaseInsensitiveComparer()); lprint(l);

each time i sort with either of that comparers the order of "a","A" is
changed,
though the Compare("a","A") returns 0.

is this an error ?
using the same comparer class twice should return the same order ?!

thanks in advance
andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140513/5f694c60/attachment.html>


More information about the Mono-list mailing list