0

I have a class:

public class CommentDto 
{
    public long Id { get; set; }
    //....
    public List<AttachmentDto> Attachments { get; set; }
}

I want to get AttachmentDto collection, which includes all Attachments from all Comments

I try to do it:

        var attachments = comments.Where(p => p.Attachments.Count > 0).Select(p => p.Attachments).ToList();

but it returns a collection with nested collections, but I want to have a one collection, which collects attachments from all comments

How to do it?

Oleg Sh
  • 8,496
  • 17
  • 89
  • 159

0 Answers0