Domanda

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
È stato utile?

Soluzione

You need to use an additional from clause:

from f in g
select f

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top