如何在asp.net windows应用程序中获取文件夹路径 [英] How to get folder path in asp.net windows application

查看:121
本文介绍了如何在asp.net windows应用程序中获取文件夹路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要文件夹路径和Windows应用程序中该文件夹中的所有文件。



如果有人有任何想法请分享。



我尝试过:



string exePath = Application.StartupPath;

I need folder path and all files in that folder in windows application.

If anybody have any idea please share.

What I have tried:

string exePath = Application.StartupPath;

推荐答案

这是代码。你也可以使用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();


这篇关于如何在asp.net windows应用程序中获取文件夹路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆