Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 如何获得两个二维数组之间的交集?_Arrays_Vb.net_Multidimensional Array_Intersection - Fatal编程技术网

Arrays 如何获得两个二维数组之间的交集?

Arrays 如何获得两个二维数组之间的交集?,arrays,vb.net,multidimensional-array,intersection,Arrays,Vb.net,Multidimensional Array,Intersection,我想得到两个二维数组之间的交集,并将其作为一个二维数组返回,函数声明如下: Private Function GetIntersection(ByVal Array2D1 As String(,), ByVal Array2D2 As String(,)) As String(,) 末级 Private Function GetIntersection(ByVal one As List(Of Pair), ByVal second As List(Of Pair)) As List(Of

我想得到两个二维数组之间的交集,并将其作为一个二维数组返回,函数声明如下:

Private Function GetIntersection(ByVal Array2D1 As String(,), ByVal Array2D2 As String(,)) As String(,)
末级

 Private Function GetIntersection(ByVal one As List(Of Pair), ByVal second As List(Of Pair)) As List(Of Pair)
    Dim intersection As New List(Of Pair)

    If second.Count = 0 Then
        second = one
    End If
    intersection = one.Intersect(second).ToList
    Return intersection
End Function

您希望如何进行比较?a1(x,?)与所有a2(?),或a1(x,?)与a2(x,?)。例如:a1(0,0)={{“2”,“Name”}a1(0,1)={{“3”,“Name”}a2(0,0)={{“3”,“Name”}a2(0,1)={“3”,“Keyword”}。a1中也属于a2的所有元素(或等效地,a2中也属于a1的所有元素)然后,a3(0,0)={{“3”,“Name”}
 Private Function GetIntersection(ByVal one As List(Of Pair), ByVal second As List(Of Pair)) As List(Of Pair)
    Dim intersection As New List(Of Pair)

    If second.Count = 0 Then
        second = one
    End If
    intersection = one.Intersect(second).ToList
    Return intersection
End Function