Nathan McKaskle
Nathan McKaskle

Reputation: 3063

Process.Kill() Method is Missing

So I've looked around all over the place and nobody seems to have this problem. I added using System.Diagnostics to the list of references, so Process exists, but not the Kill method. Nowhere does it show up in the Intellisense menu. It has a Start method. No Kill method. It has a GetProcessesByName method but no Kill method. What is going on here?

foreach(var x in objServerList)
{
    Process[] proc = Process.GetProcessesByName("myproc.exe", x);
    proc.ki //nope it's missing, not in the long list of options
    Process.ki //nope, not there either
}

Upvotes: 0

Views: 95

Answers (1)

Gilad Green
Gilad Green

Reputation: 37299

proc is an array of Process so it'll have methods relevant to arrays. Access a specific index and then you will have the methods of the Process type:

proc[index].Kill()

By the way your second attempt of Process.Kill does not work because the class Process does not have a static method of Kill

Upvotes: 3

Related Questions