第一种:
/// <summary> /// 读取txt文件内容 /// </summary> /// <param name="Path">文件地址</param> public void ReadTxtContent(string Path) { StreamReader sr = new StreamReader(Path, Encoding.Default); string content; while ((content = sr.ReadLine()) != null) { Console.WriteLine(content.ToString()); } }
原文地址:https://www.cnblogs.com/yinmu/p/10994947.html
时间: 2024-11-05 14:57:49