Why has a lambda with no capture changed from a static in C# 5 to an instance method in C# 6?

Roslyn (the C# compiler used by VS 2015) changed all lambda methods to non-static methods, whether they capture variables or not. See Delegate caching behavior changes in Roslyn. As I explain, this is an allowed behavior because anonymous methods (like those at issue here) that don’t capture variables have fewer lifetime requirements than those that do. This doesn’t mean, though, that those methods must be static: this is merely an implementation detail.

Leave a Comment

techhipbettruvabetnorabahisbahis forumueduseduedueduseduseduseduedusedusedu