static void Main(string[] args)
4 {
5 var contacts = new List<Contact>();
6
7 contacts.Add(new Contact("Michael", "520-331-2718",
8 "33140 SW Liverpool Lane", "WA"));
9 contacts.Add(new Contact("Jennifer", "503-998-1177",
10 "1245 NW Baypony Dr", "OR"));
11 contacts.Add(new Contact("Sean", "515-127-3340",
12 "55217 SW Estate Dr", "WA"));
13
14 var WAContacts =
15 from c in contacts
16 where c.State == "WA"
17 select new { c.Name, c.Phone };
18
19 Console.WriteLine("Contacts in the state of Washington: ");
20 foreach (var c in WAContacts)
21 {
22 Console.WriteLine("Name: {0}, Phone: {1}", c.Name, c.Phone);
23 }
24 }
4 {
5 var contacts = new List<Contact>();
6
7 contacts.Add(new Contact("Michael", "520-331-2718",
8 "33140 SW Liverpool Lane", "WA"));
9 contacts.Add(new Contact("Jennifer", "503-998-1177",
10 "1245 NW Baypony Dr", "OR"));
11 contacts.Add(new Contact("Sean", "515-127-3340",
12 "55217 SW Estate Dr", "WA"));
13
14 var WAContacts =
15 from c in contacts
16 where c.State == "WA"
17 select new { c.Name, c.Phone };
18
19 Console.WriteLine("Contacts in the state of Washington: ");
20 foreach (var c in WAContacts)
21 {
22 Console.WriteLine("Name: {0}, Phone: {1}", c.Name, c.Phone);
23 }
24 }