Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'        Slide program -- Keyboard shortcut: 't'    Same program with use of query syntax.Lecture 16 - slide 10 : 11
Program 4
using System;
using System.Collections.Generic;
using System.Linq;

public class Example1{
  
  public static void Main(){

    // A comma-sep. list of all male first names, youngest first.

    IEnumerable<string> names =  
       from p in Person.SomePersons
       where p.Sex == Sex.Male
       orderby p.Age
       select p.FName;

    string result = 
       names.Aggregate("", (res, nm) => res + " " + nm);

   Console.WriteLine("Result = {0}", result);
                                        // Result =  Per Stig Martin
  }
}