ReSharper: Access to modified closure

On the advice of Jay Wren, I decided to try our ReSharper 4.1.  I had previously installed DevExpress' CodeRush and Refactor Pro.  CodeRush was uninstalled in less than a week.  There was nothing technically wrong with the product – it's a great product.  It just didn't "jive" with the way I typed.  There was too much "un-learning" that would need to be done on my part to really show CodeRush's power.  The Refactorings rocked and I loved the graphical indicators it used while refactoring.

But back to ReSharper.  I've been using it for about two weeks now and I've since uninstalled Refactor Pro.  ReSharper's refactorings work well for me and their static code analysis is sweet.  It finds all the little things you may not have thought about and usually has a simple "click here" to fix the issues it finds.

But the reason for this blog post was that I was getting a warning from Resharper in some of my LINQ queries: Access to modified closure.  I wasn't really sure exactly why it was giving me the warning so I did some digging.  There's a post on the JetBrains forum which explains why the warning happens and also lists a bunch of links that will help you understand the concept better.

The original forum Post.

Additional resources mentioned in the post:

And another article that gets into this subject too (see "Captured variables" near the end of the page).

Technorati Tags: ,,,

No Comments