Question

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
Was it helpful?

Solution

You need to use an additional from clause:

from f in g
select f

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top