c# get directory list in alphabetical order code example Example: Directory.GetFiles sorted by name var sorted = Directory.GetFiles(".").OrderBy(f => f);