Functional Programming with C# is Live!

After a few months in the works I’m excited to announce that my second Pluralsight course, Functional Programming with C#, is now live! In this course you can learn how to take advantage of several functional programming techniques including immutability, higher-order functions, and functional pipelining within your existing C# projects.

If you’re a .NET developer interested in functional programming but not yet ready to jump to F# or just want to leverage functional techniques in your existing projects please check it out!

6 comments

  1. Dave I really like the course, I particularly liked the piece about thinking in a functional way.

    I was wondering if you any advice or examples when methods do need to cause a side effect or change state, e.g. saving the state of an object to persistent storage for instance. Would you ever consider these in a function way or should they always terminate a method chain in general ?

    1. I’m not sure that I completely understand your question but I think it’s completely natural to end a chain with a void method since void methods represent what you’re doing with the data that has flowed through the chain. That said, most of the time I simply invoke the void method via Tee and ignore the result rather than trying to wrap the functionality in a more generalized method. If you don’t want to implicitly ignore the result as C# is happy to let you do, you can define another simple method that makes it explicit that you’re ignoring it in a manner similar to what F# does.

      public static void Ignore(this T @this) { }

      You won’t really gain anything from a method like this in C# but when you read the code it’ll be a signal to yourself that you’ve done something with a side effect and don’t care about the result.

      1. You got the essence of what I was getting at. I like the idea of ignore as you say it signals to myself and others that I’m acknowledging that there is a side effect. Thanks Dave, this is awesome and comes just at the right time for something I’m working on!

Comments are closed.