回复 12楼 yhlvht
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class program
{
static void Main(string[] args)
{
List<string> list = new List<string>();
while (true)
{
if (Console.ReadKey().Key == ConsoleKey.F1)
{
StreamWriter sw = new StreamWriter()("D:\\save.txt");
for (int i = 0; i < list.Count; i++)
{
sw.WriteLine(list[i]);
}
sw.Close();
return;
}
list.Add(Console.ReadLine());
}
}
}
}