What is StreamReader/StreamWriter class?
mReader and StreamWriter are classes of namespace System.IO. They are used when we want to read or write charact90, Reader-based data, respectively.
Some of the members of StreamReader are: Close(), Read(), Readline().
Members of StreamWriter are: Close(), Write(), Writeline().
Ex:
Class Program1
{
using(StreamReader sr = new StreamReader(“C:\ReadMe.txt”)
{
//----------------code to read-------------------//
}
using(StreamWriter sw = new StreamWriter(“C:\ReadMe.txt”))
{
//-------------code to write-------------------//
}
}
No comments