| The average age of all females. | Lecture 16 - slide 4 : 11 Program 2  | 
using System;
using System.Collections.Generic;
using System.Linq;
public class Example1{
  
  public static void Main(){
    // The average age of all females:
    double result = Person.SomePersons
       .Where(p => p.Sex == Sex.Female)
       .Select(p => p.Age)
       .Average();
   Console.WriteLine("Result = {0}", result);  // Result = 37,3333333333333
  }
} |