E
escher4096
Hi all,
In C# 2.0, if I take a set of strings and toss them into an ArrayList
and then sort them it does not always work as expected.
I used some garbage data (I just grabbed the using statements from the
top of my own program which were out of order):
using System;
using System.ComponentModel;
using System.Collections.Specialized;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
sorted them and got:
using System.Collections.Specialized;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System;
when I expected:
using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
I played around with it a little bit and found out that when I removed
the ';' they sorted as expected. Put the ';' back in and whackyness
ensues. This just seems odd to me, is there a special IComparer class
I should be using instead of the default string one? Does anyone know
why the default string sort wouldn't have sorted this?
Thanks
-Cam
In C# 2.0, if I take a set of strings and toss them into an ArrayList
and then sort them it does not always work as expected.
I used some garbage data (I just grabbed the using statements from the
top of my own program which were out of order):
using System;
using System.ComponentModel;
using System.Collections.Specialized;
using System.Collections;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
sorted them and got:
using System.Collections.Specialized;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System;
when I expected:
using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
I played around with it a little bit and found out that when I removed
the ';' they sorted as expected. Put the ';' back in and whackyness
ensues. This just seems odd to me, is there a special IComparer class
I should be using instead of the default string one? Does anyone know
why the default string sort wouldn't have sorted this?
Thanks
-Cam