Created
July 1, 2018 23:53
-
-
Save NNNIC/91b565b3ac1456ec950700602f344402 to your computer and use it in GitHub Desktop.
Kill process C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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