Usefull Lambda Expression

Rajesh_Kumar
Posted by Rajesh_Kumar under LINQ category on | Points: 40 | Views : 808
int[] numbers = {1,2,3,4,5};

var result = numbers.Select(n => n);

foreach(var n in result)
{
Response.Write(n + " ");
}

result = numbers.Select(n => n + 1);

foreach (var n in result)
{
Response.Write(n + " ");
}


1st Output: 1,2,3,4,5
2nd Output: 2,3,4,5,6

Comments or Responses

Login to post response