Chapter 6

Encapsulating Data in Closures

WHAT’S IN THIS CHAPTER?

  • Constructing functions dynamically
  • Solving scope issues with closures

The capability of a programming language to work with higher order functions means that the problem of data scope becomes apparent. When functions are passed around as parameters and return values, the compiler uses closures to extend variable scope so that data is guaranteed to be available when needed.

Get Functional Programming in C#: Classic Programming Techniques for Modern Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.