List<string> color = new List<string>() { "red", "yellow", "green", "black", "blue" };
//使用where子句
var result = from c in color
where c.Length > 4
select c;
//使用Where操作符
var result2 = color.Where(u => u.IndexOf("ll") > -1);
Response.Write("查询长度大于4的字符串:<br/>");
foreach (var item in result)
{
Response.Write(item + "<br/>");
}
Response.Write("查询包含子串ll的字符串:<br/>");
foreach (var item in result2)
{
Response.Write(item + "<br/>");
}