LINQ
LifeOases
这个作者很懒,什么都没留下…
展开
-
LINQ——分组
List<int> numbers = new List<int>() { 11, 18, 23, 24, 27, 31, 32, 35, 36 }; IEnumerable<IGrouping<int,int>> query = from num in numbers group num by num % 2; foreach ..原创 2020-09-21 15:39:51 · 458 阅读 · 0 评论 -
LINQ——查询语法
LINQ有两种语法:a. Lamda语法: var selectWords = words.Where(w => w.Length == 3);b. Query语法: var selectWords = from word in words where word.Length > 3 select word;原创 2020-09-21 14:43:14 · 161 阅读 · 0 评论