Killing all threads that opened by application

后端 未结 7 862
长发绾君心
长发绾君心 2020-12-06 03:58

I have some really big application mixture of c# and j#.

Sometimes when I close it, there are some threads that are not closed and they are hanging in the task mana

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 04:37

    You should close your threads gracefully, but just want you and others to know the way that is not recommended but possible:

    on your OnClose Handler:

    System.Diagnostics.Process.GetCurrentProcess().Kill();
    

    I totally prefer Cody Gray way of doing it.

提交回复
热议问题