Articles → .NET → LINQ Basics
LINQ Basics
Querying In-Memory Collections
private static List<string> people = new List<string>()
{
"Granville", "John", "Rachel", "Betty",
"Chandler", "Ross", "Monica"
};
protected void Page_Load(object sender, EventArgs e)
{
IEnumerable<string> query = from p in people select p;
foreach (string person in query)
{
Response.Write(person);
}
}
IEnumerable<string> query = from p in people where p.Length > 5 orderby p select p ;