string path = @"C: UsersusersDesktopxxxx.txt";// 文件路径
FileStream filestream = new FileStream(path, FileMode.Open);
byte[] bt = new byte[filestream.Length];
//调用read读取方法
filestream.Read(bt, 0, bt.Length);
string base64Str = Convert.ToBase64String(bt);
filestream.Close();
string FileName=@"C: UsersusersDesktopxxxx.txt";// 文件路径
lsitstr 需要保存的字符串
using (FileStream fileStream = File.Create(FileName))
{
byte[] bytes = new UTF8Encoding(true).GetBytes(liststr);
fileStream.Write(bytes, 0, bytes.Length);
fileStream.Close();
}