[Solved] C# Select all elements from List which exists in another list


Now, what I want to do is select all DISTINCT by name elements from
listA where the dictionary Attributes key equals any value from the
Filters list.

To define a distinct by property you could use define a group by name and take the first one. To define a filter, you could use Keys property from the dictionary to search any key on the filters list.

var result = listA.Where(x => x.Attributes.Keys.Any(a => Filters.Contains(a)))
                  .GroupBy(x => x.Name)
                  .Select(x => x.First())
                  .ToList();

1

solved C# Select all elements from List which exists in another list