Closures: Lambdas That Remember

A lambda can use the local variables around it. It captures the variable itself, not a copy of its value, and keeps it alive for as long as the lambda lives, which is how a method can hand back a counter that remembers its count.

By

Updated

Cheat sheet: Closures: Lambdas That Remember
Category
C#
Level
Journeyman
Tags
Closure (c-sharp), c-sharp, Lambda Expression (c-sharp), Local Variable (c-sharp), Scope (c-sharp)