简体   繁体   中英

How to get the path of a CSV file inside Solution Exporer?

I have a CSV file inside my solution explorer:

解决方案资源管理器

How do I pass the path of file inside the Solution Explorer?

Code:

String filepath="C:\\Users\\vikas\\Desktop\\fetching.csv";
DataTable dt = new DataTable();
string[] lines = System.IO.File.ReadAllLines(filepath);

in place of filepath passing file inside the Solution Explorer path.

let us suppose you have a file called test.txt in a directory TestFolder

you can access it like this :

string filePath = AppDomain.CurrentDomain.BaseDirectory + @"\TestFolder\test.txt";
string[] lines = System.IO.File.ReadAllLines(filepath);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM