我有一些代码:
string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
string pathDownload = Path.Combine(pathUser, @"documents\iracing\setups\");
DirectoryInfo dinfo = new DirectoryInfo(pathDownload); // Populates field with all Sub Folders
FileInfo[] Files = dinfo.GetFiles("*.sto");
foreach (FileInfo file in Files)
{
listBox2.Items.Add(file.Name);
}
我希望显示:documents\iracing\setups\
的子文件夹,而不是文件...包括 .sto 文件。我需要的只是列出子文件夹....我不知道该怎么做?谢谢!