ConsoleKeyInfo info = Console.ReadKey(); while (true) { if (info.Key == ConsoleKey.UpArrow)//只能输入一次但会保留这种状态 { Console.Write("sdfdsg"); } } }
while (true) { ConsoleKeyInfo info = Console.ReadKey();//不输入就无法执行循环 if (info.Key == ConsoleKey.UpArrow) { Console.Write("sdfdsg"); } } }
class Food :RANDOM { public void food() { random(); } public void theout(object source, System.Timers.ElapsedEventArgs e) { Console.Write("sdfs"); } } 主函数 System.Timers.Timer t = new Timer(3000);//3秒执行一次 Food f = new Food(); t.Enabled = true; t.Elapsed += f.theout; t.AutoReset = true; Console.ReadKey();
http://blog.csdn.net/xw_andy/article/details/4896185
C#中StringBuilder类的使用总结
http://www.jb51.net/article/45832.htm