获取要创建的所有文件和文件夹

编程入门 行业动态 更新时间:2024-10-08 04:30:48
本文介绍了获取要创建的所有文件和文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在布局中将所有文件夹放到我的表格中Tiles。 之后,当我点击任何文件夹时,它会显示子文件夹和文件。 你能告诉我任何解决方案吗? 谢谢!

i wanna get all folders to my form within the layout is "Tiles". After that, when i click any folder, it will show sub-folder and files. Can you give to me any solution? Thanks!

推荐答案

怎么样'文档' [ ^ ]?

如果你只想获取目录,那么System.IO命名空间就是你的朋友。您可以读取目录,并在每个目录中获取文件。 msdn.microsoft/en-us/library/system.io(v = vs.110).aspx [ ^ ](MSDN上的System.IO) 您可以使用此代码枚举文件系统中的目录。 If you just want to get the directories, then the System.IO namespace would be your friend. You can read the directories and inside each directory you can get the files. msdn.microsoft/en-us/library/system.io(v=vs.110).aspx[^] (System.IO at MSDN) You can use this code, to enumerate the directories inside your file system. List<string> dirs = new List<string>(Directory.EnumerateDirectories(dirPath)); // since it is a list of strings, foreach (string dir in dirs) { Console.WriteLine(dir); // or if it is an ASP.NET project Response.Write(dir); }

此后,您可以获取该目录中的文件。

After this, you can get the files in that directory.

List<string> files = new List<string>(Directory.EnumerateFiles(dirPath)); // since it is a list of strings, foreach (string file in files) { Console.WriteLine(file); // or if it is an ASP.NET project Response.Write(file); }

..对每个目录重复相同的过程,并为包含每个元素的每个元素处理Click事件下一个目录的名称。

..repeat the same process for each of the directory and handle the event of Click for each element that contains the name of the next directory.

更多推荐

获取要创建的所有文件和文件夹

本文发布于:2023-11-28 11:23:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642200.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!