Thread.CurrentThread.Abort();如果是在void Main中直接用return;即可...

解决方案 »

  1.   

           static void Main(string[] args)
            {
                bool run = true;            while (run)
                {
                    Console.WriteLine("set run to false can exit the ConsoleApplication.");
                }
            }       1,run the main until end of main.
           2,kill the process of the Console Application.
           
      

  2.   

    Environment.Exit(0);//退出码,一般填0就可以了
      

  3.   

    谢谢vwxyzh,Environment.Exit(0);能够退出控制台程序,而且不需要捕获异常!!
      

  4.   

    在主函数Main()中return就会退出程序了.
    在子函数中,使用Thread.CurrentThread.Abort();