© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
11 replies
yatta

How to kill a process ?

I just know about process killing and try to test it, here is my code:
using System.Diagnostics;

var processes = Process.GetProcessesByName("Sublime Text ");
foreach(var process in processes)
{
    process.Kill();
}
Console.WriteLine("Process is killed");
using System.Diagnostics;

var processes = Process.GetProcessesByName("Sublime Text ");
foreach(var process in processes)
{
    process.Kill();
}
Console.WriteLine("Process is killed");

When I run the program, there's no error occurred but the Sublime Text process doesn't killed, isn't killing a process means we have it vanished in Task Manager ?. Since there is no error so I have no idea where i'm wrong
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ✅ Kill Process
C#CC# / help
3y ago
❔ Address already in use after a kill process
C#CC# / help
4y ago
✅ Reliably kill .NET processes
C#CC# / help
4y ago
❔ How to close a process's handle?
C#CC# / help
4y ago