What's the difference between a reader/writer class and stream class??
Printable View
What's the difference between a reader/writer class and stream class??
A Stream literally represents a stream of raw data, i.e. a series of Bytes that flows from a source to a destination. Readers and writers generally sit on top of a something (often a Stream) and translate that data in some way. For instance, the TextReader and TextWriter classes do as their names suggest and all reading and writing of text. The StreamReader and StreamWriter classes inherit TextReader and TextWriter and provide that text reading and writing functionality for Streams. The translation is done from Bytes to text or from text to Bytes using an Encoding. The underlying Stream can be any type, e.g. FileStream, MemoryStream, NetworkStream. This means that you can read text from and write text to a Stream in exactly the same way regardless of what's at the other end.