I have referred to the following question at: Using foreach loop to iterate through two lists. My question is this, with regards to the chosen answer: Can the o.DoSomething be a comparison? As in:
For Each a in ListA.Concat(ListB)
If(a from ListA=a from ListB) Then
Do Something here
End If
Next
As you might’ve guessed, I’m using VB.Net and would like to know how I can do what I have shown here. That would basically be to iterate through a joined list separately/independently. Thanks!
Your question indicates that you need a
Joinoperation, because it’s not that you want to iterate over two lists, but you also want to match like items from one list to the other.Other answers recommend
Zip. That is simply a function that takes two sequences and produces a single result, much like join, but it is geared to work in a FIFO method over both lists. If you need connections made based on an equality,Joinis the specifically built to be right tool for this job.