In this article I am going to show how we can get all
running process name and their Id in c#. For this we need System.Diagnostics namespace.
My
Output:

Image 1.
My xaml.cs is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;
namespace GetAllTaskList
{
/// <summary>
/// Interaction logic for
Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void
Window_Loaded(object sender, RoutedEventArgs e)
{
Process[] processes = Process.GetProcesses();
foreach (Process
pro in processes)
{
listBoxAllProcess.Items.Add(pro.Id + "
- " + pro.ProcessName);
}
}
}
}