Read a text file
Here is an easy way to read the entire contents of a text file into a string array in C#
Use File.ReadAllLines() to read the file into memory
Pass ReadAllLines() the path to the text file. It will return a string array with each line in the file an element in the array.
var contents = File.ReadAllLines(inputFilePath);
For further information, see the following:
How to read from a text file