get all text from file txt to c# as string code example
Example 1: read text file to string c#
string mystring = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");
Example 2: c# read all text from a file
using (StreamReader streamReader = new StreamReader(path_name, Encoding.UTF8))
{
contents = streamReader.ReadToEnd();
}