string line = string.Empty; List<string> lines = new List<string>(); using (StreamReader reader = new StreamReader(@"text1.txt")) { line = reader.ReadLine(); while (line !=""&&line !=null) { lines.Add(line); Console.WriteLine(line); line = reader.ReadLine(); } } //通过C#中的泛型来记录
关键字词: