Write a program using Linq to create a sequence that contains common first letter from both Product and Customer names?

 Posted by Kmandapalli on 1/22/2014 | Category: LINQ Interview questions | Views: 5870 | Points: 40

var productFirstChar = from P in Products
select P.ProductName[0];

var customerFirstChar = from C in Customers
select C.CompanyName[0];

var commonFirstChar = productFirstChar.Intersect(customerFirstChar );

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response