且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在asp.net windows应用程序中获取文件夹路径

更新时间:2022-03-07 22:21:04

这是代码。你也可以使用Application.StartupPath。

另外,你说Asp.Net Windows应用程序的主题有些错误,因为ASP.Net仅用于基于Web的应用程序。





Here is the code. You can also used Application.StartupPath.
Also, your subject is slightly wrong as you say Asp.Net Windows Application as the ASP.Net is used for Web based app only.


var path = System.IO.Directory.GetCurrentDirectory();
           var files = Directory.GetFiles(path).Select(f=>Path.GetFileName(f)).ToList();
           files.ForEach(f => Console.WriteLine(f));
           Console.ReadKey();