Convert query expression to dot notation
I want to convert these two query expressio开发者_开发知识库n into dot notation
Q1
var x = from tbl in Person.Get(2, cat.Count)
group cat[i] by i/10;
Q2
foreach(var a in x)
string.Split("-", a);
How to do?
This is untested, but please see if this produces correct results for you -
var catList = Person.Get(2, cat.Count);
catList.GroupBy(c => catList.Indexof(c)/10).Select(a => a.Split("-", a))
IEnumerable<string[]> result = (from tbl in Person.Get(2, cat.Count)
group cat[i] by i/10).Select(x=>x.Split('-'));
精彩评论