Permalink
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (33 sloc) 860 Bytes
class WhereSample2
{
static void Main()
{
// Data source.
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
// Create the query with two predicates in where clause.
var queryLowNums2 =
from num in numbers
where num < 5 && num % 2 == 0
select num;
// Execute the query
foreach (var s in queryLowNums2)
{
Console.Write(s.ToString() + " ");
}
Console.WriteLine();
// Create the query with two where clause.
var queryLowNums3 =
from num in numbers
where num < 5
where num % 2 == 0
select num;
// Execute the query
foreach (var s in queryLowNums3)
{
Console.Write(s.ToString() + " ");
}
}
}
// Output:
// 4 2 0
// 4 2 0