1、代码
1 using System; 2 using System.Collections.Generic; 3 using System.IO; 4 using System.Linq; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace ConsoleApplication4 9 { 10 class Program 11 { 12 static void Main(string[] args) 13 { 14 using (StreamReader sReader = new StreamReader(@"1.txt", Encoding.Default)) 15 { 16 string aLine = sReader.ReadLine(); 17 Console.WriteLine(aLine); 18 } 19 Console.ReadKey(); 20 } 21 } 22 }
2、txt文件
3、效果
时间: 2024-10-29 00:07:14