C Sharp How To Read A Text File

[Solved] C Sharp How To Read A Text File | Csharp - Code Explorer | yomemimo.com
Question : c sharp how to read a text file

Answered by : boris-krischel

// To save the text as one string use 'ReadAllText()'
string text = System.IO.File.ReadAllText(@"C:\filepath\file.txt");
// To save each line seperately in an array use 'ReadAllLines()'
string[] lines = System.IO.File.ReadAllLines(@"C:\filepath\file.txt");

Source : | Last Update : Sat, 29 Feb 20

Question : how to read a text file C#

Answered by : enchanting-earthworm-van0jwgx3b1k

string[] text = System.IO.File.ReadAllLines(@"C:\users\username\filepath\file.txt");

Source : | Last Update : Tue, 13 Oct 20

Answers related to c sharp how to read a text file

Code Explorer Popular Question For Csharp