I have a linq query that is showing an error:
I see this error any time I try to access the variable I'm iterating over, if the source of the collection is a linq query. I guess this error is just telling me the variable could change, or something like that?
This error is telling you that the reference to pubConfig
inside your query will be using the value of pubConfig
at the time the query is evaluated, and not at the time where you define it and store it in pubConfigSettings
.
In practical terms, you will be OK if the query is evaluated "on the spot". If you keep it around for later evaluation, and the value of pubConfig
changes in the meantime, you will encounter unexpected results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With