Tuesday, October 6, 2009

LINQ Basic Sample with arrays


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LINQSamp1
{
class Program
{
static void Main()
{
int[] ages = { 47, 45, 53, 57,44,63,66 };
IEnumerable seniorcitizen =
from n in ages
where n >50
select n;
foreach (var x in seniorcitizen)
Console.Write("Senior Citizen aged:{0}\n", x);
Console.Read();
}
}
}




www.codecollege.NET

No comments:

Post a Comment