1. 程式人生 > >C# txt文件操作

C# txt文件操作

            string path = AppDomain.CurrentDomain.BaseDirectory + "operalog.txt";
            if (!System.IO.File.Exists(path))
            {
                FileStream stream = System.IO.File.Create(path);
                stream.Close();
                stream.Dispose();
            }
            using (StreamWriter writer = new StreamWriter(path, true))
            {
                writer.WriteLine(CCNO);
                writer.WriteLine(CCtype);
                writer.WriteLine(Status);
                writer.WriteLine(clsPageCond.limit);
                writer.WriteLine(clsPageCond.Page);
            }