O'Reilly logo

Functional Programming in C#: How to write better C# code by Enrico Buonanno

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Designing programs with function composition

This chapter covers

  • Defining workflows with function composition and method chaining
  • Writing functions that compose well
  • An end-to-end example of handling server requests with workflows

Function composition is not only powerful and expressive but also pleasant to work with. It’s used to some extent in any programming style, but in FP it’s used extensively. For example, have you noticed that when you use LINQ to work with lists, you can get a lot done with only a few lines of code? That’s because LINQ is a functional API, designed with composition in mind.

In this chapter we’ll cover the basic concept and techniques of function composition and illustrate its use with LINQ. We’ll also ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required