使用 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。