如何在一个Uinteger数组中比较两个UInteger数组和复制公共元素 [英] How to compare two UInteger array and copy common element in one Uinteger array

查看:141
本文介绍了如何在一个Uinteger数组中比较两个UInteger数组和复制公共元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想比较两个UInteger数组值并在一个Uinteger数组中复制常用值。两种尺寸都不一样??????

I want to compare two UInteger array values and copy common values in one Uinteger array. both sizes are not same??????

推荐答案

试试相交 [ ^ ]



来自文章:

Try Intersect[^]

From the article:
' Create two integer arrays.
Dim id1() As Integer = {44, 26, 92, 30, 71, 38}
Dim id2() As Integer = {39, 59, 83, 47, 26, 4, 30}

' Find the set intersection of the two arrays.
Dim intersection As IEnumerable(Of Integer) = id1.Intersect(id2)

Dim output As New System.Text.StringBuilder
For Each id As Integer In intersection
    output.AppendLine(id)
Next

' Display the output.
MsgBox(output.ToString)

' This code produces the following output:
'
' 26
' 30


这篇关于如何在一个Uinteger数组中比较两个UInteger数组和复制公共元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆