Appendix A. Working with previous version of C#

This second edition of the book was written for C# 10 and takes advantage of the language’s latest features, given that they’re relevant to FP. If you’re working on legacy projects that use previous versions of C#, you can still apply all of the ideas discussed in this book. This appendix shows you how.

A.1 Immutable data objects before C# 9

In the book, I’ve used records and structs for all data objects. Records are immutable by default, and structs are copied by value when passed between functions so that they too are perceived as being immutable. If you want to work with immutable data objects but need to use a version prior to C# 9, you have to rely on one of the following options:

  • Treat objects ...

Get Functional Programming in C#, Second Edition 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.