public static List<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(); }
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
Read file content with File reader
using (StreamReader stream = File.OpenText(PathOfFile)) { string fileContentsDatas = stream.ReadToEnd();
}
Subscribe to:
Posts (Atom)