Sorting?
-
I used Array.Sort to sort my string array.For example string[] ss=new string[]{ AA,aA,aa,Aa,BB,Ba } Array.Sort(ss); Now the result of ss is AA Aa BB Ba aA aa but i need it sort likes dictionary. aa aA Aa AA Ba BB How can i do this ? thank=)
Basically .NET tries to follow the sorting rules of the current culture, so the first thing to do is to make sure the sorting is done wit hthe correct cultures. If you are still not happy with the way it is done, you can provide your own comparison rules to the sorting methods.
-
I used Array.Sort to sort my string array.For example string[] ss=new string[]{ AA,aA,aa,Aa,BB,Ba } Array.Sort(ss); Now the result of ss is AA Aa BB Ba aA aa but i need it sort likes dictionary. aa aA Aa AA Ba BB How can i do this ? thank=)
The default sorting is based on the ascii values where you are getting 'BB ' entry before 'aA'. In your case you will have to write your own way of sorting the array.