On Thu, 24 May 2007 13:18:54 -0700, Carla Simeoni <c.****@subnet.net>
wrote:
Some sample source codes use TextWriter other StreamWriter for writing
text into a file.
What are the differences ?
In addition to what Alberto said, one reason you may see both is that
there may be code that wants to be able to support any TextWriter (two
common ones being the built-in StreamWriter and StringWriter). That way
you have use the same code to write, for example, your text to a file or a
string.
In fact, this sort of thing is one of the big reasons we have virtual
functions and interfaces. The ability to declare some basic API common to
a wide variety of object, each with their own custom implementation. :)
Pete