// To save the text as one string use 'ReadAllText()'
string text = System.IO.File.ReadAllText(@"C:filepathfile.txt");
// To save each line seperately in an array use 'ReadAllLines()'
string[] lines = System.IO.File.ReadAllLines(@"C:filepathfile.txt");
using (StreamReader streamReader = new StreamReader(path_name, Encoding.UTF8))
{
contents = streamReader.ReadToEnd();
}
string[] text = System.IO.File.ReadAllLines(@"C:usersusernamefilepathfile.txt");
var text = File.ReadAllText(file, Encoding.GetEncoding(codePage));
List of codepages : https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers?redirectedfrom=MSDN