xxxxxxxxxx
// Example #1
// Read the file as one string.
string text = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");
// Example #2
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Public\TestFolder\WriteLines2.txt");
xxxxxxxxxx
string textFile = "C:\\data.txt";
string[] lines_raw = File.ReadAllLines(textFile);
// To get all lines and delete empty lines
string[] lines = File.ReadAllLines(videoListPath).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();