string[] currentVideoGames = {"Morrowind",
"BioShock", "Half Life 2"};
// Build a
query expression using extension methods
// granted
to the Array via the Enumerable type.
var subset
= currentVideoGames .Where(game
=> game.Length > 6)
.OrderBy(game
=> game)
.Select(game
=> game);
OR
Enumerable.Where(currentVideoGames,
( game => game.Length > 6))
.OrderBy(game
=> game)
.Select(game
=> game);
Getting Counts:
currentVideGames .Where( game => game.Length >
6)
.Select(game=>
game)
.Count<string>();
OR
(from
game in currentVideGames
where
game.length > 5
select
game
).Count<String>();
Reversing Results:
(from
game in currentVideGames
where
game.length > 5
select
game
).Reverse<String>();
Sorting Results:
from
game in currentVideGames
where
game.length > 5
descending
select game
Comments