I am getting a list of running processes via LINQ.
The two properties I want are "ProcessName" and "WorkingSet64".
However, in my UI, I want these properties to be called "ProcessName" and "ProcessId".
How can I remap the name "WorkingSet64" to "ProcessId"?
I did a pseudo syntax of what I am looking for below:
using System.Linq;
using System.Windows;
using System.Diagnostics;
namespace TestLinq22
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
var theProcesses =
from p in Process.GetProcesses()
orderby p.WorkingSet64 descending
select new { p.ProcessName, p.WorkingSet64 alias "ProcessId" };
foreach (var item in theProcesses)
{
TheListBox.Items.Add(item);
}
}
}
}