c# get the contents of a file code example
Example 1: c# read all text from a file
using (StreamReader streamReader = new StreamReader(path_name, Encoding.UTF8))
{
contents = streamReader.ReadToEnd();
}
Example 2: how to read a text file C#
string[] text = System.IO.File.ReadAllLines(@"C:\users\username\filepath\file.txt");