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.