Well, first of all, here's the picture:
Here is the official explanation of the Textreder: (http://msdn.microsoft.com/zh-cn/library/system.io.textreader.aspx)
Here is the official explanation of the Stream class: (http://msdn.microsoft.com/zh-cn/library/system.io.stream.aspx)
We want to use the FileStream and StreamReader these two classes. Well, let's take a look at their MSDN description of this class!
First look at the FileStream (Http://msdn.microsoft.com/zh-cn/library/system.io.filestream.aspx) class on MSDN as follows:
filestream class to read from, write to, open, and close files on a file system, As file-related operating system handles including pipes, standard input, and standard output. "> Use the filestream class to read, write, open, and close files on file systems, and to manipulate other file-related operating system handles, such as pipelines, standard input, and standard output. filestream buffers input and output for better performance." > filestream buffered input and output for better performance. --part of the content to delete a simple
filestream buffers input and output for better performance." > Look again, the StreamReader (Http://msdn.microsoft.com/zh-cn/library/system.io.streamreader.aspx) class is described on MSDN as follows:
streamreader is designed to character input in a particular encoding, whereas the Stream class is designed for byte input and Output. " > streamreader is designed to enter characters in a specific encoding, while the Stream class is used for byte input and output. streamreader for reading lines of the information from a standard text file. > Use the streamreader to read the line information for a standard text file.
Unless otherwise specified,the default encoding for StreamReader is UTF-8, not the ANSI code page for the current system. UTF-8 can correctly handle Unicode characters and provide consistent results on localized versions of the operating system.
By default,StreamReaderis not thread-safe. For information about thread-safe wrappers, see TextReader . Synchronized. --filestream buffers input and output for better performance. " section of the content to delete the
filestream buffers input and output for better performance. " >
From the comparison of these two descriptions, we know that FileStream is mainly operation filestream class to read from, write to, Open, and close files on a file system, as as is as to manipulate the other file-related operating system handles including PIP ES, standard input, and standard output. > file system files, then what is the file system, according to my understanding is the existence of files on the network.
So StreamReader it just reads the lines of the standard text file, and my understanding is to manipulate the contents of the local text file.
Well, we already know what these two files are for, so we know when to use them. The specific use of finishing after the paste out. For easy use later.