fix Issue 9628 - Lambda in foreach loop Vs. lambda in static foreach loop
Merge pull request #2029 from 9rnsr/fix9628

Issue 9628 - Lambda in foreach loop Vs. lambda in static foreach loop