I ran across a weird issue, but there is certainly a miss from my side. Check if you can point that out. I was doing this in foreach
loop but then I switched to a for
loop to avoid looping ambiguities, but still it fails.
// Update each quantum.
for (int i = 0; i < Quantums.Where(a => a.Language != "en-US").Count(); i++)
{
Quantums[i].ListQType.AddRange(AddedOnes);
}
What happens is that the list AddedOnes
gets added to all quantums in Each iteration and not only to the one we are dealing in the loop body. I suspect references mess.
Any pointers?
Thanks