C#StreamReader和StreamWriter

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace streamreader和streamwrite
{
    class Program
    {
        static void Main(string[] args)
        {
            using (StreamReader sr = new StreamReader(@"C:\Users\yn\Pictures\C#\C#.txt", Encoding.Default))
            {
                while (!sr.EndOfStream)
                {
                    Console.WriteLine(sr.ReadLine());
                }
            }

            using (StreamWriter sw = new StreamWriter(@"C:\Users\yn\Pictures\C#\123.txt"))
            {
                sw.Write("123123");
            }

            Console.ReadKey();
        }
    }
}

你可能感兴趣的:(C#StreamReader和StreamWriter)