title: Windows CE. How to kill a process by name?
body: <p>Im looking for a way to kill a process by name using C# on WindowsCE</p>
  
  <p>The .NET Compact Framework doesnt have a Process.GetProcessByName() method it only has a .GetProcessById() method. </p>
  
  <p>But i dont know how i can figure out the process id of my running process. </p>
  
  <p>I was thinking i could loop though all the process ids, but this is horrible because i dont know the max number of process ids. Anyone know a better way?</p>
  
  <pre><code>        for (int i = 1; i &lt; 40000; i++)
          {
              Process prs = Process.GetProcessById(i);
  
              if (prs.StartInfo.FileName == "MyExe.exe")
              {
                  prs.Kill();
              }
  
              prs.Dispose();
          }
  </code></pre>
  
  <p><strong>EDIT: I found the solution to my problem. A codeproject link.
  <a href="http://www.codeproject.com/Articles/36841/Compact-Framework-Process-class-that-supports-full" rel="nofollow">http://www.codeproject.com/Articles/36841/Compact-Framework-Process-class-that-supports-full</a></strong></p>