Restituisce l'intersezione set di due sequenze

Utilizzare l'operatore Intersect per restituire l'intersezione di due insiemi di sequenze.

Esempio

In questo esempio viene Intersect usata per restituire una sequenza di tutti i paesi/aree geografiche in cui si trovano sia Customers che Employees in tempo reale.

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)

In LINQ to SQL l'operazione Intersect è ben definita solo nei set. La semantica per i multiset non è definita.

Vedere anche