using System;
    using System.IO;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace _20210815_01
    {
    class Program
    {
    static void Main(string[] args)
    {
    FileStream fs = new FileStream(“C:\Users\16023\Desktop\test.txt”, FileMode.OpenOrCreate, FileAccess.ReadWrite);


    StreamWriter sw = new StreamWriter(fs); // 创建写入流
    sw.WriteLine(“Hello World”); // 写入Hello World
    sw.Close(); //关闭文件
    Console.WriteLine(“OK”);
    Console.ReadKey();
    }
    }
    }