
INTRODUCTION
xiv
WHAT THIS BOOK COVERS
The language of the vast majority of examples in this book is C# 4.0, running on Microsoft .NET.
There are a few examples in other languages, but they are for illustrative purposes only. If you
want to try out the examples for yourself, but you ’ re not on C# 4.0 or Visual Studio 2010 yet,
you may still have success using C# 3.0 and Visual Studio 2008 — there aren ’ t many new features
in C# 4.0 specifi cally, and none of them have been exploited in the examples. However, a few
examples utilize .NET Framework features like Parallel Extensions, which are available only
in .NET 4.0.
The book introduces you to concepts of functional programming and describes how these can
be used with the C# language. An effort has been made to provide samples with a practical
background, but most of them still focus mostly on language level considerations. Functional
programming is a technique for code, algorithm and program structure — as opposed to, for
instance, application architecture. Of course it needs to fi t in with application architecture . . . you
get the point: it ’ s sometimes hard to fi nd the perfect compromise between being too theoretical and
going off - focus, but I ’ ve tried my best.
While I wrote this book, I developed a library of functionally oriented helpers, called FCSlib (that ’ s
“ Functional CSharp Library ” ). You can use this library in your own projects as you like, but please
note that it doesn ’ t come with any warranty. The downloadable fi le containing the library code
(more information about downloads in the upcoming section “ Source Code ” ) includes a copy of the
LGPL license text, which applies to the FCSlib code.
HOW THIS BOOK IS STRUCTURED
This book has four parts. The fi rst part provides an overview of functional programming, both
from a historical and a current point of view. Part II proceeds to give you the C# background
you ’ ll need to understand the more complex examples that follow later. Again, reading this is
recommended even if you know C# — it does have a few pretty basic items, but generally it ’ s not
meant to be a language introduction for newbies.
Part III is the most important one. Its 10 chapters describe a variety of functional programming
topics from a C# point of view, showing lots of examples and code snippets. The code library that
accompanies this book, FCSlib, is built on the ideas described in this part.
Finally, Part IV gives you an overview of practical concerns of using functional programming in
C#. I picked a few specifi c scenarios, and there are descriptions of functional programming ideas in
existing products and technologies that you may be familiar with.
WHAT YOU NEED TO USE THIS BOOK
All code in this book has been tested with Visual Studio 2010, C# 4.0 and .NET 4.0. Much of it
has been originally developed on C# 3.0, so you should have good success running the code on
.NET 3.5. Going back further than that would mean major rewrites in many areas — the concepts