hmm there is the StreamReader that I've been using all the time, and then there is the FileStream class. Would someone care to explain the big difference between these. Which one should I use for reading text files?
Printable View
hmm there is the StreamReader that I've been using all the time, and then there is the FileStream class. Would someone care to explain the big difference between these. Which one should I use for reading text files?
The FileStream is the class that basically is the file, the StreamReader is used to read or interept the data in the FileStream and convert it to more useful things (like strings). There are other kinds of Streams as well, like Memory and Network which all derive from the same base Stream Class. The StreamReader and Writer are what we use to interact with these streams, unless you want to do it byte by byte.
To use an analog the Stream is like a CD and the Stream Reader/Writer is like the CD Player.
aha cool:) thanks, makes more sense