I've got two List<string>
, one contains user's IDs
and their emails, second contains only emails. I am trying to find duplicated emails from second list in the first list, and input email's IDs in a variable.
Example: 1st List content:
emailswithIDs = List<string> {1, abc@gmail.com, 2, abcd@gmail.com, 3, abcde@gmail.com
2nd List content:
emails = List<string> {abcd@gmail.com}
So I'd like to make variable "IDs" which would contain "2" as it is the ID of duplicated email.
I have tried:
var IDs = emails.Intersect(emailswithIDs);
But obviously it will only get the duplicated string, and I need to get the email's ID value.