using System.IO;
namespace 读一行TXT内容
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = @"D:\123\123.txt";
            string conTent; ;
            FileStream fs = new FileStream(path,FileMode.OpenOrCreate);
            using (StreamReader sr=new StreamReader(fs, Encoding.Default))
            {
                do
                {
                    conTent = sr.ReadLine();
                    Console.WriteLine(conTent);
                } while (conTent != null);
            }
            Console.ReadKey();
        }
    }
}

  

posted on 2022-06-02 20:36  sbwynnss  阅读(54)  评论(0)    收藏  举报