1
Answer

Using multiple lists in a single 'foreach'

Simon Mann

Simon Mann

16y
9.3k
1
Hey there, I'm new and was wondering if someone coud help me out.

I was wondering whether it's possible to have two lists being parsed by the same foreach loop.

i.e.
foreach (Object obj in _objectList)

becoming

foreach (Object obj in _objectList, Client cli in _clientList)


The logic I'm trying to parse involves the method being able to call values from both lists and using them together. I tried calling two foreach loops, but they seem unable to share their data.

Cheers in advance for any help.

Answers (1)