Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试访问我的项目中的文件。
所以我会创建一个名为的新文件夹Files,该文件夹内包含各种 HTML 文件。
Files
无论如何,我可以通过访问"Program/Files/file.html"或类似的方式访问这些文件。
"Program/Files/file.html"
你的意思是这样的吗?
using System.IO; ... string folderPath = AppDomain.CurrentDomain.BaseDirectory; // or whatever folder you want to load.. foreach (string file in Directory.EnumerateFiles(folderPath, "*.html")) { string contents = File.ReadAllText(file); }