title: Ways to kill a running program and how to trap them?
body: <p>We have different ways to kill a running C# program.</p>
  
  <ol>
  <li>ctrl + C;</li>
  <li>task bar then right click its icon, then select 'close' on the popup;</li>
  <li>task manager, select the its executable name and then click end process;</li>
  <li>console window, use kill command;</li>
  </ol>
  
  <p>maybe more.</p>
  
  <p>What I am asking here is how handle them in my C# program to guarantee my C# program exit gracefully when possible. I know how to trap ctrl + C, but don't the others. can you help me? thanks,</p>