Pipeline Style

Pipeline Style programming brings a more functional programming style of coding to C#. Inspired by F# pipelining and C# LINQ method syntax, this tiny set of extension functions, add more functional programming features to C#.

Some of the benefits of Pipeline Style
  • Creates a fluent programming paradigm, converting statements to expressions
  • Replaces code nesting with linear sequencing
  • Eliminates variable declaration - does not even require a var
  • Provides some form of variable immutability
  • Structures code into small lambda methods with clear responsibilities
Pipeline Style can be easily ported to Java too.

Hopefully similar features make it into future versions of C# as first class parts of the language.

See below a small sample of the extension methods and how they replace conventional C# coding.

Cheat sheet: Pipeline Style uses extension method family - 'Do' on Actions & 'To' on Functions.

Conventional.PNG

PipelineStyle.PNG

Last edited Nov 14, 2012 at 4:15 AM by hocho, version 4