Consider this code:
var files = Directory.GetFiles(filePath);
var dataFiles = from file in files
where System.IO.Path.GetExtension(file) == extension
orderby file.Length
select file;
I've been looking for a string comparator that will do "natural sort". Sadly, there is no build-in functionality for this common task. I found this post and it looks good.
Can I use NaturalStringComparer with LINQ query syntax? I am aware of the solution with lambdas.