您的位置:首页 > 产品设计 > UI/UE

【vs.net 2008系列-LINQ】 11.Queryable.Intersect(TSource) 方法

2008-11-10 10:34 330 查看
MSDN说明:

通过使用默认的相等比较器对值进行比较生成两个序列的交集。

Code

Imports System.Linq.Expressions

Module Module1

Sub Main()

Dim id1() As Integer = {0, 1, 5, 7, 8, 9, 10}

Dim id2() As Integer = {0, 8, 9, 12, 19, 21}

Dim both As IEnumerable(Of Integer) = id1.AsQueryable().Intersect(id2)

Dim output As New System.Text.StringBuilder()

For Each id As Integer In both

output.AppendLine(id)

Next

Console.WriteLine(output.ToString())

Console.ReadLine()

End Sub

End Module
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐