C# kill 进程
private void button1_Click(object sender, EventArgs e)
{
Process[] allProcess = Process.GetProcesses();
foreach (Process p in allProcess)
{
string processName = "WinConst.vshost";
// 判断主程序是否在运行
if (processName.ToLower().Trim() == p.ProcessName.ToLower().Trim())
{
for (int i = 0; i < p.Threads.Count; i++)
p.Threads[i].Dispose();
p.Kill();
break;
}
}
}