I thought this was a capture issue but nothing I do works. try to simplify here:
foreach (Question question in Test.Questions)
{
int id= question.id;
if(someIDictionary.TryGetValue(id, out value)
{
question.answerobject.number=someinteger;
}
else
{
question.answerobject.number=someotherinteger;
}
}
I tried making a temp for question object, but still not working. all results are always last iteration value.
EDIT: Each answerobject is created within each question object as the question is created using linq to sql. then the questions are returned as an IList.
EDIT 2: The issue does not occur if I assign values to another field of question. the issue is only with the answerobject.the values of answerobject are same for all questions (the last assignment).