读取文件内容
使用 System.IO.StreamReader
文档地址 System.IO.StreamReader.
FileStream fileStream = new FileStream("file.txt", FileMode.Open);
using (StreamReader reader = new StreamReader(fileStream))
{
string line = reader.ReadLine();
}
使用 System.IO.FileSystem操作
Nuget 地址 https://www.nuget.org/packages/System.IO.FileSystem/
System.IO.File.ReadAllText("MyTextFile.txt");
写入文件
byte[] info = new UTF8Encoding(true).GetBytes(value);标签:info,读取,netcore,写入,System,IO,FileSystem,new,StreamReader From: https://blog.51cto.com/dupeng0811/6142396
fs.Write(info, 0, info.Length);