Hi All
In this blog you will get to know some of the problems i have faced during my day to day work. and the solutiosn that i have used for those problems.
Monday, March 18, 2013
c# split list into sub lists
publicstaticList<List<T>> Split<T>(List<T> source)
{
return source
.Select((x, i) => new { Index = i, Value = x })
.GroupBy(x => x.Index / 4)
.Select(x => x.Select(v => v.Value).ToList())
.ToList();
}
No comments:
Post a Comment