Implement Your Option Wrapper

Implement a lightweight version of the Option type.

So far, we have used the Option type as a replacement for null and C# 8.0 nullable references when working with previous versions of the C# language. Also, we learned that C#, unlike functional languages, doesn’t have a built-in Option type. We have to either use a third-party library or write our own Option type. Let’s write our own lightweight Option type to see its inner workings.

Get hands-on with 1200+ tech skills courses.