以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- [转发]LINQ简单用法 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=170917) |
-- 作者:wei0769 -- 发布时间:2021/8/11 12:37:00 -- [转发]LINQ简单用法 从网上抄来的,可以在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编辑过]
|