I have 2 sequences:
l1 = { "a1", "a2"}
l2 = { "b1", "b2"}
I want to return a third sequence:
l3 = { new A {a = "a1", b = "b1"}, new A {a = "a2", b = "b2"}}}
How can I use linq to do so?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re looking for the zip operation from functional programming, which takes corresponding elements from two sequences and builds a third sequence containing the matching pairs. In C#, this is implemented using Enumerable.Zip. You can get the specific result you are looking for with