A comma-separated list of all male first names, youngest first. | Lecture 16 - slide 4 : 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. string result = Person.SomePersons .Where(p => p.Sex == Sex.Male) .OrderBy(p => p.Age) .Select(p => p.FName) .Aggregate("", (res, nm) => res + " " + nm); Console.WriteLine("Result = {0}", result); // Result = Per Stig Martin } } |