Your application includes a collection of Product entities named products and a list of strings named excludedProductNames. You need to create a LINQ query to return a list of all product names that are not in the excludedProductNames collection.

Which LINQ query should you use?

 Posted by Rajkatie on 8/31/2012 | Category: ADO.NET Interview questions | Views: 2092 | Points: 40
Select from following answers:
  1. var list = products.Select(p => p.ProductName).Except(excludedProductNames);
  2. var list = products.Select(p => p.ProductName).Union(excludedProductNames).Distinct();
  3. var list = products.Distinct().Select(p => p.ProductName).Union(excludedProductNames);
  4. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response