Fluent Building for Func and Profit

functional patterns in C#


In this short article we are going to see some minimal case of the specification pattern but also is a glimpse on compositionality of C# delegates. Lets say we have this simple item

by creating the following extension on strings

we can write the declarative

by further adding the extension

we can write now expressions like the following;

Currying the expression

by currying the Add<> above we get the following

but can you write something like this for example:

yes you can by some creativity on types by extension methods:




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store