I have a class called Questions
. This Questions
has properties QuestionID
and QuestionAnswer
. While iterating through this List of Question
in foreach, I have to find .QuestionID = 12
. If I find .QuestionID = 12
then I have to immediately assign a value to .QuestionAnswer = "SomeText"
of .QuestionID = 14
.
I don't want iterate again inside .QuestionId = 12' to find
.QuestionID = 14` again.
Is there any way I can go directly to .QuestionID = 14
using LINQ?.
For example:
For Each mQuestion As Question In _mQuestions
If mQuestion.QuestionId = 12 Then
'Find mQuestion.QuestionID= 14 and insert Somtext to
'mQuestion.QuestionAnswer="SomeText"
End IF
Next