Comparing Ints in Two List

I have 2 list that both contain an int.I want to compare the int in List 1 to the int in List 2.And if they’re the same then i want the texture2d in list 2 to be the texture 2d in list 1.Can anyone ple give me an example script of the concept i am looking for.Thanks

If you know the value of integer before hand then you can use List.Contains() on both the lists to check if they both contain that integer.

If you want to check if both lists have any common integer then you can do it like:

This code is not tested, but you can use the logic.

int i=0;
while(i < List1.Count)
{
    if(List2.Contains(List1*))*

{
// There is a common item so perform the required action.
}
else
{
i++; // We increment the value of i to check for next element from List1.
}
}