What is the use of ReadLine() method in StreamReader class.

 Posted by vishalneeraj-24503 on 1/27/2014 | Category: C# Interview questions | Views: 1073 | Points: 40

ReadLine is a StreamReader method which returns the next text line from the text file.It reads line one by one from the text file.

For Example:-

string file_contents;

ArrayList arr_list = new ArrayList();

using (StreamReader sr = new StreamReader("C:\\rpt.txt"))
while ((file_contents = sr.ReadLine()) != null)

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response