Anonymous Types : var : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » var »

 

Anonymous Types








    
 

using System;
using System.Collections.Generic;
using System.Diagnostics;

class MainClass{
    static void DisplayProcesses(Func<Process, Boolean> match) {
        var processes = new List<Object>();
        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);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» var