linq快速比较两个列表

    Sub compareLists(ByVal lst1 As String(), ByVal lst2 As String())
       ‘通过对话框获取两个药对比文件的数据到两个列表。
       Dim ofdg1 As New OpenFileDialog
        Dim ofdg2 As New OpenFileDialog
        Dim path1 As String = String.Empty
        Dim path2 As String = String.Empty
        If ofdg1.ShowDialog = vbOK Then
            path1 = ofdg1.FileName
        End If
        If ofdg2.ShowDialog = vbOK Then
            path2 = ofdg2.FileName
        End If
        If System.IO.File.Exists(path1) And System.IO.File.Exists(path2) Then
            Dim list1 As String() = System.IO.File.ReadAllLines(path1)
            Dim list2 As String() = System.IO.File.ReadAllLines(path2)
            compareLists(list1, list2)
        End If       
        Dim differenceQuery = lst1.Except(lst2)
        ' Execute the query.
        For Each name As String In differenceQuery
            Debug.Print(name)
        Next

    End Sub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值