C# winform中如何获取路径下的文件夹名?

2024-11-20 07:00:14
推荐回答(4个)
回答(1):

using System.IO;

String[] dirs = Directory.GetDirectories(@"C:\");
comboBox1.Items.AddRange(dirs);

回答(2):

using System.IO;
String[] dirs = Directory.GetDirectories(@"C:\");
comboBox1.Items.AddRange(dirs);

回答(3):

Directory.GetDirectories(filePath)

回答(4):

System.IO.Directory.CreateDirectory("c:\\").GetDirectories()