Using LINQ, how can I find a list of items where it\'s list of components contains a component from another list of components?
Structure:
class Item
{
It should be the other way around: first the Any and then the Contains. You would like to get all items that have any of there components contained in the components list.
Also don't use the Select if you'd like to get a list of Item back:
var result = items.Where(i => i.Components.Any(c => components.Contains(c.Name)));