第十二章 linq
1.索引筛选 .Where((r,index)=>r.Name.StartsWith("N"&&index%2==0))
2.类型筛选 object[] data={"你好","呵呵",1,2} 类型筛选 .OfType<string>();
2.符合筛选:
3.Linq 查询定义变量
- var countries=from r in Formulal.GetChampions()
- group r by r.Country into g
- let count=g.Count()
- orderby count descending,g.key
- where count>=2
- select new
- {
- Country=g.Key,
- Count=count
- }
4.Cast ()