我如何知道我的C#控制台应用程序何时会停止?有没有发生过类似的事件?控制台应用程序C的关闭事件#
谢谢!应用领域
class Program
{
static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
}
static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
Console.WriteLine("exit");
}
}
你想让代码退出应用? –
[这个问题是与你的相似] [1] [1]:http://stackoverflow.com/questions/1119841/net-console-application-exit-event – greijner