Array.Sort() does not work for sorting directory paths in alphebetical order. I also made this loop to sort them but it does not work either:
How else can I do this?
Code:
public static string[] Sort_DirectoryPathsByAll(string[] paths, char AorD)
{
if(paths.Length==1) return paths;
string[]Pths=new string[paths.Length];
Array.Copy(paths, Pths, paths.Length);
string hold="";
if(AorD=='A')
{
for(int i=0; i < Pths.Length; i++)
{
for(int j=0; j < Pths.Length-1; j++)
{
for(int k=Pths[j].Length, l=Pths[j+1].Length; (k<0 && l<0); k--, l--)
{
if(Pths[j][k] > Pths[j+1][k])
{
hold= Pths[j+1];
Pths[j+1]= Pths[j];
Pths[j]= hold;
}
}
}
}
}
else
{
}
return Pths;
}
How else can I do this?