Im very confused with the exact difference between them and different usage approach of these two TextWriter/Reader derived types StringWriter/Reader and StreamReader/Reader.
I know that using them we can deal easily with character based data in stream avoiding byte fuss as working direclty using Filestream…
Im very confused with the exact difference between them and different usage approach of
Share
TextWriter/Reader is an abstract class. It provides an abstraction for writing/reading character based data to/from a data source.
StreamWriter/Reader is a concrete implementation that uses a writeable/readable Stream as data source. Since a Stream is abstraction for writing/reading byte based data, an Encoding instance is required for the translation between characters and bytes.
StringWriter/Reader is a concrete implementation that uses a StringBuilder/string as data source.