【C#学习笔记】写文件

using System;
using System.IO;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            FileStream file = new FileStream("log.txt", FileMode.OpenOrCreate);
            StreamWriter sw = new StreamWriter(file);
            sw.Write("xiaoming");
            sw.Close();

        }      
    }
}

 

转载于:https://www.cnblogs.com/tiandsp/p/7440418.html

你可能感兴趣的:(【C#学习笔记】写文件)