How to read StreamReader text line by line

66

How to read StreamReader text line by line -

private static List<string> DownloadLines(string hostUrl)
    {

    List<string> strContent = new List<string>();

    var webRequest = WebRequest.Create(hostUrl);

    using (var response = webRequest.GetResponse())
    using (var content = response.GetResponseStream())
    using (var reader = new StreamReader(content))
        {
            while (!reader.EndOfStream)
            {
                strContent.Add(reader.ReadLine());
            }
        }

    return strContent;

}

Comments

Submit
0 Comments