StreamReader类
命名空间:using system.IO;
StreamReader sr=new StreamReader(filePath,System.Text.Encoding.Default);
创建一个文件读取器
filePath,文件传入路径(本地路径的写法:@“c:\temp\demo\textname.txt”)
System.Text.Encoding.Default,指定编码方式的一种,还有其他的编码方式,如UTF8(默认),UTF7,UTF32,UNICODE等。
命名空间:using system.IO;
StreamReader sr=new StreamReader(filePath,System.Text.Encoding.Default);
创建一个文件读取器
filePath,文件传入路径(本地路径的写法:@“c:\temp\demo\textname.txt”)
System.Text.Encoding.Default,指定编码方式的一种,还有其他的编码方式,如UTF8(默认),UTF7,UTF32,UNICODE等。