I have two objects of type IList:
public class SampleSentence
{
public int SampleSentenceId { get; set; }
public string Text { get; set; }
}
IList<SampleSentence> Old =
[new SampleSentence() { SampleSentenceId = 1; Text = 'cat' }]
IList<SampleSentence> New =
[new SampleSentence() { Text = 'cat' }],
new SampleSentence() { Text = 'dog' }]
What I need to get is:
IList<SampleSentence> whatINeed =
[new SampleSentence() { Text = 'dog' }]
- Object
Old
is a list of SampleSentences with the SampleSentenceId and Text fields populated. - Object
New
is a list of SampleSentences with the only the Text fields populated. It will have the same or more rows than objectOld
Using LINQ how can I compare the Old
and New
objects (linking them with the contents of Text) and create another IList that has the additional columns in the list named New
?