首页 > 代码库 > C# 把string字符导出到txt文档方法

C# 把string字符导出到txt文档方法

public static string writtxt(string html, string file)
        {
            FileStream fileStream = new FileStream(Environment.CurrentDirectory + "\\" + file, FileMode.Append);
            StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.Default);
            streamWriter.Write(html + "\r\n");
            streamWriter.Flush();
            streamWriter.Close();
            fileStream.Close();
            return "ture";
        }

 

C# 把string字符导出到txt文档方法