using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace tasklist
{
class Program
{
static void Main(string[] args)
{
//创建新的 Process 组件的数组
Process[] myProcesses = Process.GetProcesses();
Console.WriteLine("以下获得的为正在运行的进程");
Console.WriteLine("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
foreach (Process myProcess in myProcesses)
{
Console.WriteLine(myProcess.ProcessName);
}
int taskcount = myProcesses.Length;
Console.WriteLine("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
Console.WriteLine("共有进程数:"+taskcount.ToString());
Console.ReadLine();
}
}
}