# Discriminated Unions in C# Mono Compiler

DevFeed: [Discriminated Unions in C# Mono Compiler](<https://devfeed.tech/articles/discriminated-unions-in-c-mono-compiler-33391.md>)

Original publisher: [Read original article](<https://timkellogg.me/blog/2012/03/10/discriminated-unions-in-c-mono-compiler>)

Published: 2012-03-10T00:00:00Z

Content type: opinion

Language: en

Sources: [Tim Kellogg](<https://devfeed.tech/sources/tim-kellogg.md>)

Topics: [F#](<https://devfeed.tech/topics/fsharp.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [.NET](<https://devfeed.tech/topics/net.md>), [OCaml](<https://devfeed.tech/topics/ocaml.md>)

Tags: [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [enum](<https://devfeed.tech/tags/enum.md>), [f-sharp](<https://devfeed.tech/tags/f-sharp.md>), [hashing](<https://devfeed.tech/tags/hashing.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

## AI overview

The author explores discriminated unions in F#, compares them with C# enums, and considers modifying the Mono C# compiler to support similar constructs in C#. The article presents this as an early-stage proof-of-concept idea rather than a completed implementation.

## Source excerpt

Recently I've been using F# a bit. F# is .NET's functional language (the syntax of F# 1.0 was backward compatible with OCaml, but 2.0 has diverged enough to make it more distinct). Learning F# was a huge mind-shift from the C-family of languages. Of all the features of F#, like implicit typing, tail recursion, and monads, many people list discriminated unions as their favorite.