Console.ReadLine(); 
Console.ReadKey();  //无法在Linux运行
复制代码
private static readonly AutoResetEvent _closingEvent = new AutoResetEvent(false);
static void Main(string[] args)
{
    //业务逻辑

// 监听CTRL+C Console.CancelKeyPress += ((s, a) => { Console.WriteLine("程序已退出!"); _closingEvent.Set(); }); _closingEvent.WaitOne(); }
复制代码

 

posted on   金科许俊  阅读(125)  评论(0编辑  收藏  举报
努力加载评论中...



点击右上角即可分享
微信分享提示