Bryan,
In addition to the other comments:
Short answer: Its called Inheritance! Remember Inheritance is one of the
major tenants of OO.
StreamReader inherits from TextReader
StringReader inherits from TextReader
In other words: both StreamReader & StringReader are types of TextReaders.
Long answer:
TextReader has all the common logic on reading characters, it declares the
"contract" on how to read characters. StreamReader has the specifics on
reading characters from a Stream (aka a File) it fills in the specific of
the "contract" to read characters from a Stream. While StringReader has the
specifics on reading characters from a String (for example the clipboard or
a TextBox) it fills in the specifics of the "contract" to read characters
from a String.
If I am writing a routine that needs to read Text, generally I will write it
based on a TextReader. This way I can pass it either a StreamReader or a
StringReader & the routine itself is non the wiser. Additionally if a new
type of TextReader is defined, my routine will be able to handle it also...
Hope this helps
Jay
"Bryan Dickerson" <tx******@netscape.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
| StreamReader says it is designed to read a stream of characters
| StringReader says it is designed to read a string
| TextReader says it is designed to read a sequential list of characters.
|
| I hate to sound like a VB6 grump, but aren't we splitting hairs?? What's
| the difference?
|
| --
| TFWBWY...A
|
|