I am using Array.Sort()
with the parameters shown in the code. I'm unable to get the required order for the following array
jONeS
jones
joNes
jones
aDaMs
adams
adaMS
ADAMs
The program shown prints the following
adams
aDaMs
adaMS
ADAMs
jONeS
jones
joNes
jones
Where as according to me the following order should be printed
aDaMs
adams
adaMS
ADAMs
jONeS
jones
joNes
jones
Note the first two elements displayed wrongly. Where am I going wrong?
int N = Convert.ToInt32(Console.ReadLine());
string[] arr=new string[N];
for (int i = 0; i < N; ++i)
arr[i] = Console.ReadLine();
Array.Sort(arr, StringComparer.Create(new CultureInfo("en-US"),true));
Console.WriteLine();
for (int i = 0; i < N; ++i)
Console.WriteLine(arr[i]);