I added a filename into a string array wich I use to display the files in a ComboBox. However they are not correctly sorted.
Is there a way to sort them by letter and number?
This is the code I used to add them to the ComboBox
string[] FilePaths = Directory.GetFiles(_infr.Konfig.Betrieb.RegelungsdatenPfad.Pfad); //Creating a string array to store the File Name of the Processdata
foreach (string file in FilePaths) //Adding the Files into the String Array
{
comboBox1.Items.Add(Path.GetFileName(file));
}
I tried to Sort them by the Length of the Filename but that didnt work the way it would
Array.Sort(FilePaths, (x, y)=\>x.Length.CompareTo(y.Length));