KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I was just curious about this: the following code will not compile, because we cannot modify a foreach iteration variable: foreach (var item in MyObjectList) { item = Value; } But the following will compile and run: foreach (var item in MyObjectList) { item.Value = Value; } Why is the first invalid, whereas the second can do the same underneath (I was searching for the correct english expression for this, but I don't remember it. Under the...? ^^ )
Tags (comma-separated)
Save Edits
Cancel