Skip to content

Instantly share code, notes, and snippets.

@Redth
Created June 12, 2014 17:51
Show Gist options
  • Select an option

  • Save Redth/0462027a0101f6fc4f68 to your computer and use it in GitHub Desktop.

Select an option

Save Redth/0462027a0101f6fc4f68 to your computer and use it in GitHub Desktop.
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get;set; }
}
var people = new List<Person> {
new Person { FirstName = "Bill", LastName = "Smith", Age = 60 },
new Person { FirstName = "Jane", LastName = "Doe", Age = 41 },
new Person { FirstName = "Joe", LastName = "Schmoe", Age = 24 }
}
foreach (var p in people.Where (p => p.Age >= 6))
Console.WriteLine ("{0} is old.", p.FirstName);
var notJane = from p in people where FirstName != "Jane" select p;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment