C#获取件夹下的所有⽂件的⽂件名String path = @"X:\xxx\xxx";
王麟个人资料
//第⼀种⽅法
var files = Directory.GetFiles(path, "*.txt");剑魂刷图加点
foreach (var file in files)
朱镇模张俪Console.WriteLine(file);
//第⼆种⽅法
陈冰整容
隆中对译文DirectoryInfo folder = new DirectoryInfo(path);
foreach (FileInfo file in folder.GetFiles("*.txt"))
{
Console.WriteLine(file.FullName);
}我们相爱吧是真的吗