Fareez Ahamed

Tag: Csharp (1)

Emulating Discriminated Unions in C# using Records

Sep 18, 2021

Discriminated Union / Sum Type is one of the common features found amoung strong typed functional languages like F#, Haskell etc. Ever since I started using them in F#, I can’t stop wondering why such an useful feature is not available on the popular languages. C# has been adding a lot of functional features over the last few years. So, we are going to achieve something close to that in C# using Records and Inheritance.

Read more...