Mega Code Archive
Categories
/
C#
/
LINQ
Anonymous Types
using System; using System.Collections.Generic; using System.Diagnostics; class MainClass{ static void DisplayProcesses(Func
match) { var processes = new List
(); foreach (var process in Process.GetProcesses()) { if (match(process)) { processes.Add(new { process.Id, Name = process.ProcessName, Memory = process.WorkingSet64 }); } } } static void Main(string[] args) { DisplayProcesses(process => process.WorkingSet64 >= 20 * 1024 * 1024); } }