using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
void printList(List<Person> list)
foreach (var person in list)
Console.WriteLine(person.FirstName);
public Char MiddleInitial { get; set; }
_firstName = value.Trim();
public String LastName { get { return _lastName; } }
public Person(String f, String l, String p)
var people = new List<Person>() {
new Person("Auri", "Rahimzadeh", "317.490.4321"),
new Person("Steve", "Wozniak", "408.555.1212"),
new Person("Scott", "Jones", "818.555.1212"),
new Person("Daishaun", "Paschall", "800.555.1212"),
new Person("John", "Doe", "317.490.4321"),
new Person("Mary", "Smith", "408.555.1212"),
new Person("Geoff", "Smith", "818.555.1212"),
new Person("Doug", "Smith", "800.555.1212")
bool DoWhere(Person person)
return person.FirstName.Contains("S");
.Where(w => w.FirstName.Contains("S"))
.OrderByDescending(o => o.FirstName)
result = (from p in people
where p.FirstName.StartsWith("S")
select p).OrderBy(o => o.FirstName).ToList();
var person = people.SingleOrDefault(f => f.FirstName.Contains("X"));
Console.WriteLine(person != null ? person.FirstName : "Couldn't find a match." );
Console.WriteLine(people.Count(c => c.FirstName.Contains("S")) > 0);
Console.WriteLine(people.Any(c => c.FirstName.Contains("S")));