다음을 통해 공유


두 시퀀스의 합집합 반환

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

예시

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

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

LINQ to SQL에서 Union 연산자는 순서가 지정되지 않은 다중 집합의 연결(SQL UNION ALL 절의 효율적인 결과)로 다중 집합에 대해 정의되어 있습니다.

자세한 내용 및 예제는 Queryable.Union을 참조하세요.

참고 항목