Functional Programming with C# - Simon Painter - NDC London 2023

Discover how to write better C# code with functional programming principles, including immutable types, referential transparency, and pure functions, for improved predictability, robustness, and testability.

Key takeaways
  • Despite the fear of imrativeness, functional programming is easy to understand and test
  • Immutable types can be used in C# for better code quality and predictability
  • Referential transparency and pure functions are essential concepts in functional programming
  • Use of functions as first-class citizens and higher-order functions for more flexibility
  • Problems can be solved without creating intermediate variables with partial application
  • Enumerables are lazy, allowing for better performance
  • Pattern matching can be used for more readable and testable code
  • C# is a hybrid language that supports both paradigmatic and object-oriented programming
  • For better code quality, use functions with no side effects and avoid mutable state
  • C# 6 and higher support switch expressions for pattern matching
  • Use functional programming for better robustness and less bugs