Welcome to the Treehouse Community
Looking to learn something new?
Aaron Selonke10,323 Points
Why use the Join() to check for duplicates
Why did Carling use the Join to check for duplicate birds between the two Lists? Why not use the Set Operators? Like Union() ?
Steven Parker221,326 Points
An inner join will only return rows where the key fields match. This makes it perfect for finding duplicates.
A Union will return all the unique rows from both sets, effectively concealing any duplication.
Samuel Ferree31,721 Points
Is there some reason we couldn't just add the birds with:
//Add imported birds, where the list of bird names does not contain their name birds.AddRange(importedBirds.Where(ib => !birds.Select(b => b.CommonName).Contains(ib.CommonName)));
Seems like this Joining and Flattening and new anonymous datatypes not really necessary.
Elshad Shabanov2,890 Points
Why we don't use Except for defining birds from imported birds list which are not in our birds list? Like this: