top of page
Newel Software LLC.
Software Development
and
IT Solutions
How to Read a Text File in C#
public static string readTextFile(string sFiletoread)
{
string sRetText = "";
try
{
using (StreamReader sr = new StreamReader(sFiletoread))
{
sRetText = sr.ReadToEnd();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString()); sRetText = e.ToString();
}
return sRetText;
}
Please reload
bottom of page