如何使用 C# 查詢檔案?


使用 C# 中的 GetDirectories 獲取最先出現的子資料夾列表 −

Directory.GetDirectories

現在遍歷這些目錄,並對子資料夾重複該過程。

string path = @"d:/New/Myfile";
string[] myDir = Directory.GetDirectories(path, "xml", SearchOption.AllDirectories);
Console.WriteLine(myDir.Length.ToString());
foreach (string res in myDir)
Console.WriteLine(res);

更新於: 2020 年 6 月 22 日

103 次觀看

開啟你的事業

完成該課程以獲得認證

開始使用
此網頁包含廣告
© . All rights reserved.