I have a List<FileInfo>
of files
(我有一个文件的List<FileInfo>
)
List<FileInfo> files = GetFiles();
which has about 2 GB of files.
(其中大约有2 GB的文件。)
Now I need to chunk these files into 500MB parts.(现在,我需要将这些文件分成500MB的部分。)
In this case the result will be 4List<FileInfo>
with the Sum of all Files is below 500MB. (在这种情况下,结果将是4 List<FileInfo>
,所有文件的总和小于500MB。)
Sum()
on this.. (我不知道如何在此应用Sum()
。)
List<List<FileInfo>> result = files.GroupBy(x => x.Length / 1024 / 1014 < 500)
.Select(x => x.ToList()).ToList();
ask by Dr. Snail translate from so