How to compare two different list without using for each loop

studio

#1

HI
how to compare two different list without using for each loop… for ex… Im having two list,
list1(MailMessage) =(“Xxxxx xxxxx@gmail.com”) and
list2(String) =(“Xxxxx xxxxx@gmail.com”)

it should generate output as mail id matched… without using for loop… I already tried by converting list1(MailMessage) to list1(String) and used list1.intersect(list2)… but it didn’t comparing and the count is 0…


#2

I’m not sure if you can do that way, but you can get all the email addresses from your mailmessage list to another list(string)

ListEmail.Add = list1(MailMessage)(1).From.Address ( for each)

and do the intersect