Skip to content

Instantly share code, notes, and snippets.

@NNNIC
Created July 1, 2018 23:53
Show Gist options
  • Save NNNIC/91b565b3ac1456ec950700602f344402 to your computer and use it in GitHub Desktop.
Save NNNIC/91b565b3ac1456ec950700602f344402 to your computer and use it in GitHub Desktop.
Kill process C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ProcessUtil
{
public static void Kill(string name)
{
var ps = System.Diagnostics.Process.GetProcessesByName(name);
if (ps!=null)
{
foreach(var p in ps)
{
p.Kill();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment