After decades of relative obscurity, functional programming is finally coming into its own. With concise, easy-to-read code that supports asynchronous, concurrent processing, aspects of functional programming have begun to appear in several traditionally object-oriented languages such as C# and Java. This practical book shows C# programmers how to use functional programming features without having to navigate an entirely new language.

Because of the shared runtime environment common to C# and F# languages, it's possible to use most of F#'s functional features in C# as well. Author Simon J. Painter explains how you can write functional code in C# right away, without having to install dependencies or features newer than .NET 3. You'll learn why functional programming concepts can bring immediate benefit to your work.

  • Learn what functional programming is and how it originated
  • Discover features of the functional paradigm using a more familiar language
  • Start coding functionally in C# right away, without relying on third-party libraries
  • Write code that's more robust, less error prone, and easier to test
  • Examine less conventional ways to look at structures available in C#
  • Explore the practicalities of using functional C# in a business environment

Table of Contents

  1. Preface
  2. 1. Introduction
  3. I. What Are We Already Doing?
  4. 2. What Can We Do Already?
  5. 3. Functional Coding in C# 7 and Beyond
  6. 4. Work Smart, Not Hard with Functional Code
  7. II. Into the Belly of the Functional
  8. 5. Higher-Order Functions
  9. 6. Discriminated Unions
  10. 7. Functional Flow
  11. 8. Currying and Partial Application
  12. 9. Indefinite Loops
  13. 10. Memoization
  14. III. And Out the Other Side
  15. 11. Practical Functional C#
  16. 12. Existing Functional Programming Libraries in NuGet
  17. 13. The Martian Trail
  18. 14. Conclusion
  19. Index
  20. About the Author