need to sort files in a directory before listing them (C#)

I'm using the Directory.GetFiles(filePath) to loop through all the files in a directory using C#.But I need those files to be sorted before I list them to the user. Is there any method to do that or do I have to do it manually?

2answers

Answers

I could now start writing a sample etc. but I must admit, others have already done this. Although I do not like to answer questions with a simple link to a web page, I recommend to look at these two articels:

Thanks, Peter. This is an advanced way of doing it. Actually I found out that for my needs I only need to sort them alphabetically (which for some reason they weren't by default), so I ended up doing this:string[] files = Directory.GetFiles(filePath);Array.Sort(files);