I want to compare two string arrays. I don\'t know how to implement this in vb.net.
Let\'s say I have two arrays
Dim A() As String = {\"Hello\", \"H
Use Linq extensions. Except
will tell you which items are different
' ones in A but not in B
Dim result() As String = A.Except(B).ToArray()
' ones in B but not in A
Dim result() As String = B.Except(A).ToArray()
And you can use Join to find same items
Here is One method to find same items, or different items
Dim a() as string = {"a", "b", "c"}
Dim b() as string = {"a", "b", "z"}
Dim sameItems() as String = a.Where(Function(i) b.Contains(i)).ToArray()
Array.ForEach(sameItems, Sub(i) Console.WriteLine(i))
Dim diffItems() as String = a.Where(Function(i) Not b.Contains(i)).ToArray()
Array.foreach(diffItems, Sub(i) Console.WriteLine(i))
And of course, you can use Intersect