Select from following answers:- var list = products.Select(p => p.ProductName).Except(excludedProductNames);

- var list = products.Select(p => p.ProductName).Union(excludedProductNames).Distinct();
- var list = products.Distinct().Select(p => p.ProductName).Union(excludedProductNames);
- All Above
To get a list of product names, you must select the ProductName property and then apply the Except operator to the result set to exclude those product names in the excludedProductsList.
Creating a union of product names in the products list and excludedProductsList and then applying the Distinct operator will return a list of distinct names across both lists. No names in the excludedProductsList will be excluded.
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator