Answer: 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)
{
arr_list.Add(file_contents);
}
}
Asked In: Many Interviews |
Alert Moderator