다음을 통해 공유


두 시퀀스 간의 차집합 반환

Except 연산자를 사용하여 두 시퀀스 간의 차집합을 반환합니다.

예시

이 예제에서는 Except을 사용하여 Customers는 살지만 Employees가 살지 않는 모든 국가/지역의 시퀀스를 반환합니다.

var infoQuery =
    (from cust in db.Customers
    select cust.Country)
    .Except
        (from emp in db.Employees
        select emp.Country)
;
Dim infoQuery = _
    (From cust In db.Customers _
     Select cust.Country) _
    .Except _
        (From emp In db.Employees _
         Select emp.Country)

LINQ to SQL에서 Except 작업은 집합에 대해서만 적절하게 정의되어 있습니다. 다중 집합에 대한 의미 체계는 정의되어 있지 않습니다.

참고 항목