I have a List<FileInfo>
of files
List<FileInfo> files = GetFiles();
which has about 2 GB of files. Now I need to chunk these files into 500MB parts. In this case the result will be 4 List<FileInfo>
with the Sum of all Files is below 500MB. I have no Idea how to apply Sum()
on this..
List<List<FileInfo>> result = files.GroupBy(x => x.Length / 1024 / 1014 < 500)
.Select(x => x.ToList()).ToList();
Here is something that works.