StreamReader类

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等。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章