示例#1
0
        static void VeryHollowQuery()
        {
            Console.WriteLine("\nVery Strange Query:\n");
            var query = from m1 in
                        (from m1 in MusicFestival.GetMusicians()
                         where m1.Birthyear >= 2010
                         select new { m1.Name, m1.PeopleCount })
                        join m2 in
                        (from m2 in MusicFestival.GetMusicians()
                         where m2.Birthyear < 2010 && m2.IsDead
                         select new { m2.Name, m2.PeopleCount }) on m1.PeopleCount equals m2.PeopleCount
                        select new { m1.Name, m2.PeopleCount };

            foreach (var m in query)
            {
                Console.WriteLine("Name:{0}\tPeople Count:{1}", m.Name, m.PeopleCount);
            }
        }