Tuesday, 16 October 2012

c sharp programming

How  To Use Lambda Expressions

int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

int[] oddNums = Common.FilterArrayOfInts(nums, i => ((i & 1) == 1));

foreach (int i in oddNums)
  Console.WriteLine(i);


1
3
5
7
9

No comments:

Post a Comment