I have the latest ReSharper 5.0 build (1655), where I have encountered the suggestion 'Access to modified closure' on the following code:
var now = new DateTime(1970, 1, 1);
var dates = new List<DateTime>();
dates.Where(d => d > now);
...
now = new DateTime();
and the now
inside the lambda expression is underlined with the warning.
I'm pretty sure that's a ReSharper bug, but is it really?
EDIT: I should have checked better, there was an assignment to now
later in the code.
EDIT 2 Jon Skeet's answer below pretty much answers this, but what about the following:
var query = dates.Where(d => d > now).ToList();
Shouldn't this solve the problem by executing the query immediately?