C# 写入文件小示例
作者:互联网
using System; using System.Configuration; using System.IO; namespace ToIO { class Program { static void Main(string[] args) { for (int i = 0; i < 10; i++) { WriteLog("Index=" + i); } } public static void WriteLog(string logMessage) { using (StreamWriter w = File.AppendText(@"E:\log.txt")) { w.WriteLine("'{0}',", logMessage); w.Flush(); } } } }
标签:string,示例,C#,void,写入,System,static,logMessage,using 来源: https://www.cnblogs.com/fenger-VIP/p/16551474.html