Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ソフトウェアに問題があり、別のフォルダにある一連の .mp4 ビデオを注文する必要があります。
これで、次の命令ですべてのビデオを取得できるようになりました。
string[] video = Directory.GetFiles("..\\..\\", "*.mp4", SearchOption.AllDirectories);
しかし、私は自分のビデオを名前順ではなく、フォルダ順に並べています。
何か案が?
ありがとう
使用できます
video.OrderBy(Path.GetFileName).ToArray();
次の using ステートメントをコードに追加します。
using System.Linq;
次に、配列を文字列で並べ替えることができます。
video = video.OrderBy(x => Path.GetFileName(x)).ToArray();