我有一些关闭应用程序的代码。但是,如果我在Visual Studio中运行应用程序并进行调试,我想停止调试并关闭计算机。任何建议:停止Visual Studio在C#代码中的调试
代码:
#if DEBUG
throw new Exception("Can't shutdown!");
#else
try
{
this.Shutdown();
}
finally
{
Process.Start("shutdown.exe", "-r -f -t 0");
}
#endif
请问如果工作?那么你可以只是application.exit,这将停止调试 – EpicKip
你目前的做法似乎工作。你不喜欢它什么? – Carra