枚举目录的最快方法

枚举目录的最快方法

本文介绍了枚举目录的最快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在寻找一种方法来列出所有目录名称以及子目录。我有大约2000多个目录,其中包含子目录。我只需要目录名称及其完整路径。此时不需要其中的文件。我基本上是想从这里创建一个树视图.net的标准方法在获取时看起来很慢。需要大约6秒才能获得清单。



谢谢。



我尝试了什么:



标准方法



List< string>显示目录=新列表与LT;字符串>(Directory.EnumerateDirectories(目录, *,SearchOption.AllDirectories));

解决方案



Hi,

I am searching for a method to list out all directories names along with sub directories. I have around 2000+ directories with sub directories within then. I just need the directory names with their full path. The files within then are not needed at this moment. I am basically trying to create a tree view from this.The standard method of .net seems very slow in fetching. Takes around 6 secs to get the list.

Thanks.

What I have tried:

The standard method

List<string> dirs = new List<string>(Directory.EnumerateDirectories(DirectoryPath,"*",SearchOption.AllDirectories));

解决方案



这篇关于枚举目录的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:58
查看更多