I am creating the image of the PowerPoint file programmatically. And after saving the Images to the local drive I am getting the files using DirectoryInfo.GetFiles()
.
I am saving the image files with the sequence numbers.
My Files:
My issue is when I get the files, are not in the sequence I need them in.
The files sequence which I am getting in the FileInfo[]
is :
Can any one help me to solve this issue?
The function doesn't make any guarantees about order but you can achieve the desired result with a simple LINQ query;
FileInfo[] sortedFiles = DirectoryInfo.GetFiles().OrderByDescending(x => x.Name).ToArray();