static Func<int, bool> del2;
public static void Main()
Console.WriteLine(result);
public static void TestMethod(int input)
del = () => { j = 10; return j > input; };
del2 = (x) => {return x == j; };
Console.WriteLine("j = {0}", j);
Console.WriteLine("j = {0}. b = {1}", j, boolResult);
private static void TakeLambdaEx()
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
var firstNumbersLessThan6 = numbers.TakeWhile(n => n < 6);
foreach (var number in firstNumbersLessThan6)
Console.WriteLine(number);
private static void LambdaQueryExpressions()
var filteredNames = Enumerable.Where(names, n => n.Length >= 4).Select(n => n.Length.ToString());
foreach (var name in filteredNames)
Console.WriteLine(name.GetType().FullName);
private static void SimpleLinq()
"Jack", "Mark", "Harry", "May"
var query = names.Select(n => new
Name = n, Length = n.Length
foreach (var row in query)
private static void LinqGroupQuery()
"Jack", "Mark", "Harry", "May"
group n by n[0] into firstCharGrp
Key = firstCharGrp.Key, Val = g
foreach (var row in query)