I have an foreach loop that looks like this
foreach (Student newSortedStudent in studentWithData) { newSortedStudent.Fees = newSortedStudent.Fees.OrderBy......ToArray(); }
but now I need to have access to this newSortedStudent object and manipulate with it more.
if I do something like this
foreach (Student newSortedStudent in studentWithData) { newSortedStudent.Fees = newSortedStudent.Fee.OrderBy......ToArray(); } foreach(Student studentData in **newSortedStudent**) { .... }
I'll get an error newSortedStudent does not exist in the current context.
So how can I access the newSortedStudent outside of that foreach loop?
Thanks