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} 
   };
data.cs
Sample data - Class Persons and a collection of persons.
ex1.cs
The average age of all females.
ex2.cs
The average age of all females - basic version.
ex3.cs
A comma-separated list of all male first names, youngest first.
ex4.cs
A sequence of female-male pairs sequences.
ex4A.cs
Same - using flattening SelecteMany.
ex4-output
Equivalent output of last two programs: all femal-male pairs.