0

i have 2 arrays

controllerlist[11] and taglist[5]

i need to compare them so that i can find any elements that match, is there a way of doing it instead of nested for loops?

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by wildgoose
0

perhaps you could do it with one for less by using the Contains method:

int[] a = new int[4] { 1, 2, 3, 4 };
            int[] b = new int[3] { 5, 6, 3 };
            bool c = a.Contains(b[2]);

The boolean c should be true here because b[2]=3 and a contains 3.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.