I have two array lists
dim Colors1 = New ArrayList
Colors1.Add("Blue")
Colors1.Add("Red")
Colors1.Add("Yellow")
Colors1.Add("Green")
Colors1.Add("Purple")
dim Colors2 = New ArrayList
Colors2.Add("Blue")
Colors2.Add("Green")
Colors2.Add("Yellow")
I would like to find out which colors are missing from Colors2 that are found in Colors1
Look at using Except method. "This method returns those elements in first that do not appear in second. It does not also return those elements in second that do not appear in first."
So you can just put colors 2 as the first argument and colors1 as the second.
EDIT: I meant you can put colors 1 first and colors 2 as the second.
EDIT2: (per Sean)
var missingFrom2 = colors1.Except(colors2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With