PrepAway - Latest Free Exam Questions & Answers

How should you complete the code?

DRAG DROP
You have the following code.

You need to return all of the products and their associated categories.
How should you complete the code? To answer, drag the appropriate code elements to the correct
targets in the answer are
a. Each code element may be used once, more than once, or not at all. You may need to drag the
split bar between panes or scroll to view content.

PrepAway - Latest Free Exam Questions & Answers

Answer: See the explanation

Explanation:
Target 1: from
Target 2: join
Target 3: on
Target 4: equals
Example: Join operations create associations between sequences that are not explicitly modeled in
the data sources. For example you can perform a join to find all the customers and distributors who
have the same location. In LINQ the join clause always works against object collections instead of
database tables directly.
C#
var innerJoinQuery =
from cust in customers
join dist in distributors on cust.City equals dist.City
select new { CustomerName = cust.Name, DistributorName = dist.Name };

https://msdn.microsoft.com/en-us/library/bb397927.aspx
https://msdn.microsoft.com/en-us/library/bb397927.aspx

One Comment on “How should you complete the code?


Leave a Reply