Why lambdas seem broken in multithreaded environments (or how closures in C# works).

I’ve been playing around with some code for.NET 3.5 to enable us to split big operations into small parallel tasks. During this work I was reminded why Resharper has the “Access to modified closure” warning. This warning tells us about Continue reading

Posted in Code Design | Tagged C#, Lambda | 3 Replies

Tip: Mocking callbacks using RhinoMocks when lambdas are involved

There is several cool language features available in C# 3.0, one of them is lambdas. It’s a handy tool when you want to execute a few lines of code where a delegate is expected. Fredrik Normén and I chatted about Continue reading

Posted in design patterns | Tagged Lambda, Mock, RhinoMocks, TDD | Leave a reply

Executing lambdas on transaction commit – or Transactional delegates.

One great thing with the TransactionScope class is that it makes it possible to include multiple levels in your object hierarchy.  Everything that is done from the point that the scope was created until it is disposed will be in Continue reading

Posted in Code Design, design patterns | Tagged Lambda, LINQ, Transactional | 2 Replies