I have two enumerables: IEnumerable<A> list1
and IEnumerable<B> list2
. I would like to iterate through them simultaneously like:
foreach((a, b) in (list1, list2))
{
// use a and b
}
If they don't contain the same number of elements, an exception should be thrown.
What is the best way to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…