Hello :
I have a list
This Linq statement does not work. But that's the Idea
DBDocuments.Where(x => DBDocumentAdditional .Find(a => a.DocumentId == x.DocumentId)).ToList().ForEach(t => t.Additional = DBDocumentAdditional );
Model:
public class Document { public long DocumentId { get; set; } public List<DocumentAdditional> Additional { get; set; } }
public class DocumentAdditional { public long DocumentId { get; set; }
public string Name { get; set; }
public string Value { get; set; } }
List<Document> DBDocuments = new List<Document>();
List<DocumentAdditional> DBDocumentAdditional = new List<DocumentAdditional>();
I populate DBDocuments list with some data from database.This List has a key which is DocumentId.
I populate DBDocumentAdditional list with some data from database.This List has a key which is DocumentId.
Now I want to use LINQ to add the DBDocumentAdditional list to the DBDocuments list, for the Matching DocumentId's. List within a List with Matching Id
I am kind of stuck on syntax to do this. Please suggest, or help.
Thank you,