从vb.net中的数组中获取值 [英] Get values from array in vb.net
本文介绍了从vb.net中的数组中获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个数组,array1和array2。 Array1有5个值,从1到5.数组2的值从1到6.我需要从数组中获取额外的值
让我完全解释
数组1 - 1,2,3,4,5
数组2 - 1,2,3,4,5,6
我需要省略相同的值并得到6作为我的答案,
可以任意帮助,
I have 2 array, array1 and array2. Array1 has 5 values from 1 to 5. Array 2 has values from 1 to 6. I need to get the extra value from array
Let me explain completely
Array1 - 1,2,3,4,5
Array2 - 1,2,3,4,5,6
I need to omit the same values and get 6 as my answer,
Can any1 help in this,
推荐答案
使用Linq:
Use Linq:
Dim a1 As Integer() = New Integer() {1, 2, 3, 4, 5}
Dim a2 As Integer() = New Integer() {1, 2, 3, 4, 5, 6}
Dim diff As Integer() = a2.Except(a1).ToArray()
这篇关于从vb.net中的数组中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文