두 시퀀스의 교집합 반환
Intersect 연산자를 사용하여 두 시퀀스의 교집합을 반환합니다.
예시
이 예제에서는 Intersect를 사용하여 Customers
와 Employees
가 모두 살고 있는 모든 국가/지역의 시퀀스를 반환합니다.
var infoQuery =
(from cust in db.Customers
select cust.Country)
.Intersect
(from emp in db.Employees
select emp.Country)
;
Dim infoQuery = _
(From cust In db.Customers _
Select cust.Country) _
.Intersect _
(From emp In db.Employees _
Select emp.Country)
LINQ to SQL에서 Intersect 작업은 집합에 대해서만 적절하게 정의되어 있습니다. 다중 집합에 대한 의미 체계는 정의되어 있지 않습니다.