// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Linq; using System.Threading; public class MainClass { public static void Main(string[] args) { int[] a = new int[] { 1, 4, 9, 25, 36, 49, 64, 81, 100 }; int maxa = a.Max(); Console.WriteLine(maxa); // same but with debug to see how it is actually done int xmaxa = a.Max((v) => X(v)); Console.WriteLine(xmaxa); } public static int X(int v) { Console.WriteLine("checking " + v + " in " + Thread.CurrentThread.ManagedThreadId); return v; } }