allprocess.cs
来自「解压包里的是用C#写的100个例子」· CS 代码 · 共 33 行
CS
33 行
using System;
using System.Diagnostics;
public class AllProcess
{
public AllProcess()
{
//
// TODO: Add Constructor Logic here
//
}
public static int Main(string[] args)
{
// 构造进程数组
Process[] procList = new Process[100];
// 得到所有的进程
procList = Process.GetProcesses();
// 打印前20个进程的进程名称和ID号
for ( int i=0; i<20; i++)
{
string strProcName = procList[i].ProcessName;
int iProcID = procList[i].Id;
Console.WriteLine(strProcName + " : " + iProcID);
}
return 0;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?