This might sound odd, but I need to find a solution to kill the process my tool is running under from the code. I can kill all the processes having the name:
foreach (Process process in Process.GetProcessesByName("name_of_my_tool"))
{
process.Kill();
}
But there might be multiple instances of the tool, and I only want to kill the current one.
So can I somehow get the id, and kill the process by it? Basically I need a suicide function.