What is the use of Close() method of StreamReader class?

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

Close() method releases all the objects which are used by StreamReader object and also closes the StreamReader objects.

string file_contents;

using (StreamReader sr = new StreamReader("C:\\rpt.txt"))
file_contents = sr.ReadToEnd();

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response