Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use the Intersect operator to return the set intersection of two sequences.
Example
This example uses Intersect to return a sequence of all countries in which both Customers and Employees live.
Dim infoQuery = _
(From cust In db.Customers _
Select cust.Country) _
.Intersect _
(From emp In db.Employees _
Select emp.Country)
var infoQuery =
(from cust in db.Customers
select cust.Country)
.Intersect
(from emp in db.Employees
select emp.Country)
;
In LINQ to SQL, the Intersect operation is well defined only on sets. The semantics for multisets is undefined.
See Also
Reference
Standard Query Operator Translation (LINQ to SQL)