Can't get the name of directories sorted by name

StewartBW 925 Reputation points
2024-07-27T23:03:39.8733333+00:00

Hello experts,

I need to get the name of directories sorted by name, just like what is shown in the Windows explorer.

3 folders are in a path, Windows show them in the below order:

0_35_33

7_07_10

18_16_40

But Directory.GetDirectories and DirectoryInfo.GetDirectories both will return in the below order:

0_35_33

18_16_40

7_07_10

Note that the below lines will not help either:

.OrderByDescending(Function(p) p.Name).ToArray()

.OrderByDescending(Function(p) p.CreationTime).ToArray()

Please help :(

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,655 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,669 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 83,206 Reputation points
    2024-07-27T23:21:37.67+00:00
    0 comments No comments