C A simple way to read all the processes on the host

  • 2021-11-02 02:02:48
  • OfStack

This article illustrates how C # simply reads all the processes on the host. Share it for your reference, as follows:


#region  Acquire windows All processes of 
public static string GetCourse()
{
  System.Text.StringBuilder sb = new System.Text.StringBuilder();
  string tempName = "";
  int begpos, endpos;
  foreach (System.Diagnostics.Process thisProc in System.Diagnostics.Process.GetProcesses())
  {
    tempName = thisProc.ToString();
    begpos = tempName.IndexOf("(") + 1;
    endpos = tempName.IndexOf(")");
    tempName = tempName.Substring(begpos, endpos - begpos);
    sb.Append(tempName + "<br /> ");
  }
  return sb.ToString();
}
#endregion

More readers interested in C # can check the topic of this site: "C # Form Operation Skills Summary", "C # Common Control Usage Tutorial", "WinForm Control Usage Summary", "C # Programming Thread Use Skills Summary", "C # Operating Excel Skills Summary", "XML File Operation Skills Summary in C #", "C # Data Structure and Algorithm Tutorial", "C # Array Operation Skills Summary" and "C # Object-Oriented Programming Introduction Tutorial"

I hope this article is helpful to everyone's C # programming.


Related articles: