问题描述
我正在查看System.IO,并写了一个小方法来计算目录中的文件数。我的问题是,当我在Windows中调试这段代码时,将鼠标悬停在集合上时就可以枚举集合。这是Windows上Visual Studio中的代码和图像。
这是有问题的代码:
static void Main(string[] args)
{
var dir = new DirectoryInfo(@"/home/user1/Downloads/Folder that
has spaces in name");
var files = dir.EnumerateFiles();
var count = files.Count();
Console.WriteLine($"Number of files in Videos Folder is {count}");
}
这是我在ubuntu上运行相同代码行时得到的:
有人可以帮助我了解这里的情况吗?这两个文件夹中都有文件,并且权限不成问题,因为我正在使用主目录中的文件夹(\ home \ user \ Downloads \ Videos)。文件夹名称不是我已经检查过的问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)