i have this piece of code here , basically i am doing a for loop as i retrieve records from database( using entity framework ) but when i want to compare using if statement theres an error :
IList<Model.question> lstQuestion = qn.GetRecords(taskID, activityID);
for(int i = 0 ; i <lstQuestion.Count()-1 ; i++)
{
.... //code here
if(lstQuestion[i].QuestionNo == lstQuestion[i++].QuestionNo) // error at i++
{
tb.Text = lstQuestion[i++].QuestionContent;
sp1.Children.Add(tb);
}
i tried
lstQuestion.Count() instead of lstQuestion.Count()-1;
also doesn't work .
QuestionNo is a column in my database table .
Full ERROR :
When i remove the whole if statement , it works fine .