Dim jh1 As New List(Of String)
Dim jh2 As New List(Of String)
For i As Integer = 0 To 10
jh1.Add("cs" & i)
jh2.Add("cs" & i)
Next
If jh1.Count<> jh2.Count Then Return "集合数量不同!"
'查询2个集合内容 是否一样!
Dim lszd1 As new Dictionary(of String,Integer)
For Each s As String In jh1
If lszd1.ContainsKey(s)=False Then
lszd1.Add(s,0)
Else
lszd1(s)+=1
End If
Next
Dim lszd2 As new Dictionary(of String,Integer)
For Each s As String In jh2
If lszd2.ContainsKey(s)=False Then
lszd2.Add(s,0)
Else
lszd2(s)+=1
End If
Next
If lszd1.Count<>lszd2.Count Then Return "内容不一样1!"
For Each s As String In lszd1.Keys
If lszd2.ContainsKey(s)=False Then Return "内容不一样2"
If lszd2(s)<>lszd1(s) Then Return "内容不一样3"
Next
'顺序必须一样则转换一下!
Dim str1 As String = String.Join(",",jh1.ToArray)
Dim str2 As String = String.Join(",",jh2.ToArray)
output.show(str1 & " " & str2 )
If String.Compare(str1, str2, False) Then Return "集合顺序内容不同!"
Return "两个家伙一样"
[此贴子已经被作者于2018/11/16 9:33:36编辑过]