
StringReader Class and StringWriter Class
Part of my 2008 study notes for exam 70-536 (.NET Framework 2.0).
Overview
- Used to read and write in-memory strings.
- StringWriter uses a StringBuilder behind the scenes.
Examples
Read and Write Strings
StringWriter a = new StringWriter();
a.Write("Hello World!");
a.Write(a.NewLine);
a.Write("I span two lines!");
StringReader r = new StringReader(a.ToString());
while (r.Peek() != -1)
{
Console.WriteLine(r.ReadLine());
}
You May Also Like

Exam 70-536 Study Notes
My study notes for Microsoft exam 70-536: .NET types, collections, generics, I/O, serialization and more, with C# examples.

Starting Exam 70-536 Study
After a burnout, I'm putting my own project on hold to study for Microsoft exam 70-536.

Design Patterns - Proxy Pattern
The Proxy Pattern, and the last article in the design patterns series, now that I've finished reading Head First Design Patterns.



