// Example #1
// Read the file as one string.
string text = System.IO.File.ReadAllText(@"C:UsersPublicTestFolderWriteText.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:UsersPublicTestFolderWriteLines2.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