im having a little trouble Ordering my files, i've researched on Stack overflow and tried all other methods but i keep getting the same problem
Thats my code:
public static List<Bitmap> CogerFotosAlamacenadas()
{
List<Bitmap> Lista = new List<Bitmap>();
DirectoryInfo Directorio = new DirectoryInfo(Environment.CurrentDirectory + "\\Almacenamiento");
FileInfo[] ListaDeFotos = Directorio.GetFiles("*.bmp");
Array.Sort(ListaDeFotos, delegate (FileInfo x, FileInfo y)
{
return string.Compare(x.Name, y.Name);
});
foreach (FileInfo foto in ListaDeFotos)
{
Image PlaceHolder = Image.FromFile(foto.FullName);
Lista.Add((Bitmap)PlaceHolder);
}
return Lista;
}
I have a serie of photos named: "Foto" + numberFrom0To300 + "bmp";
after this code is aplied my list get's the photos ordered by 0_10_100_101_102...
Already tried the default order from .GetFiles() this code and another one found in stack overflow whitout usin array.sort i always get the same result hat odd order number
but i have to order them 0,1,2,3,4... at all cost
does ayone have a good idea how to control it?