문제

I currently have:

UIEnumerable <IGrouping<PortableKey, FileInfo>> 

From this code :

var queryDupFiles = from file in fileList
    group file by new PortableKey { Name = file.Name, Length = file.Length } 
    into g
    where g.Count() > 1
    select g;

where the code for PortableKey is:

    public class PortableKey
    {
        public string Name { get; set; }
        public long Length { get; set; }
    }

Basically filtering and grabbing all files that are duplicate. How do I get it so that I have all of the FileInfo in this manner?

List<FileInfo> list
도움이 되었습니까?

해결책

You need to use an additional from clause:

from f in g
select f

This translate into .GroupBy(...).SelectMany(g => g)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top