This Linq example show you how to use where clause with array
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class LinqExample
{
[Description("In this Example show how to uses the where clause to find
all No.s of an array with a value less than 10.")]
public void LinqWhereClause()
{
int[] numbers = { 15, 4, 11, 13, 19,2, 16, 7, 12, 0 };
var ResultNums =
from num in numbers
where num < 5
select num;
Console.WriteLine("Numbers < 10:");
foreach (var R in ResultNums )
{
Console.WriteLine(R);
}
}
}
No comments:
Post a Comment