Foxtable(狐表)用户栏目专家坐堂 → [转发]LINQ简单用法


  共有2257人关注过本帖树形打印复制链接

主题:[转发]LINQ简单用法

帅哥哟,离线,有人找我吗?
wei0769
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1816 积分:19292 威望:0 精华:0 注册:2013/4/10 14:38:00
[转发]LINQ简单用法  发帖心情 Post By:2021/8/11 12:37:00 [只看该作者]

从网上抄来的,可以在FT中使用

Dim a As Integer() = {1, 2, 3, 4, 5, 6, 7}
Dim b As Integer() = {4, 5, 6, 7, 8, 9, 10}
Dim c As Integer() = {1, 2, 3, 3, 4, 1, 2, 4, 6, 1, 6, 5}
Dim v1() As String = {"中国","美国","日本","俄罗斯"}
Dim aa As New List(of Integer)
Dim bb As New List(of Integer)
aa.AddRange(a) '将数组中的元素全部加入到集合中
bb.AddRange(b) '将集合s1中的元素全部加入到集合s2中
' 交集
Dim 交集 = a.Intersect(b)
' 并集
Dim 并集 = a.Union(b)
' a有b没有的
Dim diff1 = a.Except(b)
' b有a没有的
Dim diff2 = b.Except(a)
Dim diff3 = aa.except(bb)

Dim max = a.Max()
Dim min = a.Min()
Dim avg = a.Average()
Dim dis = c.Distinct()
For Each ab As Integer In diff1
    output.show("arr   " & ab)
Next

For Each ab As Integer In diff3
output.show("list   " & ab)
Next


For Each ab As Integer In dis
output.show("distinct   " & ab)
Next



[此贴子已经被作者于2021/8/11 12:41:39编辑过]

 回到顶部