StreamReader And StreamWriter In Asp.Net
StreamReader and StreamWriter are found in the System.IO namespace.
Both classes are used for reading from and writing data to text files. These classes inherit from the abstract base class "TextReader" and "TextWriter", which supports reading and writing bytes into a file stream.
Properties and Methods of StreamWriter class.
Close() - Closes the current StreamWriter object and the underlying stream. This method is equivalent to Dispose(), that is used to release resources.
Write() - Write method is used to write data to a text stream without a newline.
WriteLine() - WriteLine method is used to write data to a text stream with a newline.
Flush() - This method Clears data from all buffers for the current writer and causes any buffered data to be written to the underlying stream.
Dispose() - It releases the unmanaged resources used by the StreamWriter and optionally releases the managed resources.
AutoFlush Property - Gets or sets a value indicating whether the StreamWriter will flush its buffer to the underlying stream after every call to System.IO.StreamWriter.Write(System.Char).
BaseStream Property - Gets the underlying stream that interfaces with a backing store.
Encoding Property - Gets the System.Text.Encoding in which the output is written.
Properties and Methods of StreamReader class.
Close() - Closes the current StreamReader object and the underlying stream. This method is equivalent to Dispose(), that is used to release resources.
Read() - Reads the next character from the input stream.
ReadLine() - Reads a line of characters from the current stream and returns the data as a string.
ReadToEnd() - Reads the stream from the current position to the end of the stream.