c# - Problems with finding efficient way of getting folder/file names/paths from drives -
i've been trying learn how create windows explorer clone using treeview hold of folder , file names , paths.
i looked lot of examples , used recursion fine, however, i've been trying huge amount of folder/file names/paths (300k+) , becomes quite slow (takes few minutes data , put treeview).
below recursion method using folder , file names , paths:
public static treenode createdirectorynode(directoryinfo directoryinfo, treenode parentnode = null) { var directorynode = new treenode(directoryinfo.name); foreach (var directory in directoryinfo.getdirectories()) { parentnode = new treenode(directory.name); parentnode.tag = directory.fullname; directorynode.nodes.add(createdirectorynode(directory, parentnode)); } foreach (var file in directoryinfo.getfiles()) { treenode tnfile = new treenode(file.name); tnfile.tag = file.fullname; directorynode.nodes.add(tnfile); } return directorynode; }
Comments
Post a Comment