using System.Collections.Generic;
public static void Main()
var people = new List<Person>()
new Person("Bill", "Smith", 41),
new Person("Sarah", "Jones", 22),
new Person("Stacy","Baker", 21),
new Person("Vivianne","Dexter", 19 ),
new Person("Bob","Smith", 49 ),
new Person("Brett","Baker", 51 ),
new Person("Mark","Parker", 19),
new Person("Alice","Thompson", 18),
new Person("Evelyn","Thompson", 58 ),
new Person("Mort","Martin", 58),
new Person("Eugene","deLauter", 84 ),
new Person("Gail","Dawson", 19 ),
var people1 = from person in people
where person.LastName.StartsWith("D")
Console.WriteLine("Number of people who's last name starts with the letter D " + people1.Count());
var person2 = (from person in people
orderby person.FirstName ascending
Console.WriteLine("First Person Older Than 40 in Descending Order by First Name " + person2.ToString());
public Person(string firstName, string lastName, int age)
public string FirstName {get;set;}
public string LastName {get;set;}
public int Age {get;set;}
public override string ToString()
return this.FirstName + " " + this.LastName + " " + this.Age;