Lecture overview -- Keyboard shortcut: 'u'  Previous page: Map, filter, and reduce -- Keyboard shortcut: 'p'  Next page: An overview of some LINQ Query Operators -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    An Introduction to LINQ - slide 4 : 11

Basic LINQ Examples
Queries on a number of Person objects
    new List<Person>{
     new Person{FName="Pippi", LName="Pi",   Age=25, Sex = Sex.Female},
     new Person{FName="Lone",  LName="Rho",  Age=51, Sex = Sex.Female},
     new Person{FName="Anni",  LName="Lyng", Age=36, Sex = Sex.Female},
     new Person{FName="Martin",LName="Beck", Age=57, Sex = Sex.Male},
     new Person{FName="Per",   LName="Birk", Age=47, Sex = Sex.Male},
     new Person{FName="Stig",  LName="Malm", Age=50, Sex = Sex.Male} 
Sample data - Class Persons and a collection of persons.
The average age of all females.
The average age of all females - basic version.
A comma-separated list of all male first names, youngest first.
A sequence of female-male pairs sequences.
Same - using flattening SelecteMany.
Equivalent output of last two programs: all femal-male pairs.