using System.Collections;
using System.Collections.Generic;
static void QueryOverStrings()
string[] currentVideoGames = {"Morrowind", "Uncharted 2", "Fallout 3", "Daxter",
IEnumerable<string> subset = from g in currentVideoGames where g.Contains(" ") orderby g
foreach (string s in subset)
Console.WriteLine("Item: {0}", s);
static void QueryOverStringsWithExtensionMethods()
string[] currentVideoGames = {"Morrowind", "Uncharted 2", "Fallout 3", "Daxter",
IEnumerable<string> subset =
currentVideoGames.Where(g => g.Contains(" ")).OrderBy(g => g).Select(g => g);
foreach (string s in subset)
Console.WriteLine("Item: {0}", s);
public static void Main()
Console.WriteLine("***** Fun with LINQ to Objects *****\n");