Here code sample uses where clause to find all elements of an array which is less than 4.
public void Sample1()
{
int[] num = { 8, 2, 4, 1, 5, 0, 2, 6, 7, 9 };
var objNum = from n in num
where n < 4
select n;
Console.WriteLine("Numbers < 4:");
foreach (var n in objNum)
{
Console.WriteLine(n);
}
}
0 comments:
Post a Comment