0

I have this LINQ which the first foreach loop is to print unique file extension and the inner foreach loop is to print all the file of that file extension.

But it breaks at the first foreach loop with error

Client side GroupBy is not supported.

var fileByFileExtension = _context.FileDocuments.GroupBy(file => file.FileExtension);

foreach (var fileExt in fileByFileExtension)
{
    WriteLine(fileExt.Key);
    foreach (var item in fileExt)
    {
        WriteLine(" " + item.FileName);
    }
}
Stefan
  • 17,448
  • 11
  • 60
  • 79
Steve
  • 2,963
  • 15
  • 61
  • 133
  • Try var fileByFileExtension = _context.FileDocuments.ToList().GroupBy(file => file.FileExtension); – andy meissner Aug 27 '20 at 06:22
  • 1
    Does this answer your question? [Client side GroupBy is not supported](https://stackoverflow.com/questions/58138556/client-side-groupby-is-not-supported) – andy meissner Aug 27 '20 at 06:24

0 Answers0