Build Your Own Option Type in C# and Use It Like a Pro



Build Your Own Option Type in C# and Use It Like a Pro

Build Your Own Option Type in C# and Use It Like a Pro

In this video, you will learn how to design a powerful and flexible implementation of the Option type, and then use it to build equally powerful domain models. It is not necessary to use third-party libraries that include Option implementation. It is not the Option type a programmer needs – such a type can be coded in minutes. What programmers truly need is the backing knowledge of how and when to use optional objects.

This video combines the two questions: defining the Option type and designing a domain model that incorporates it, into one unified demonstration. You will learn how Optional objects can be used to bridge the gap between potentially missing objects at run time, and functions that always require an object to produce a result. It is that powerful Map-Reduce combination that will make your domain models expressive on the one hand, but also extensible and composable on the other. What else could one wish for?

The complete source code from this demonstration is available in GitHub repository: https://github.com/zoran-horvat/optional

Video courses:
Beginning Object-oriented Programming with C# ► https://codinghelmet.com/go/beginning-oop-with-csharp
Collections and Generics in C# ► https://codinghelmet.com/go/collections-and-generics-in-cs
Making Your C# Code More Object-oriented ► https://codinghelmet.com/go/making-your-cs-code-more-oo

Other courses at Pluralsight ► https://codinghelmet.com/go/pluralsight
Other courses at Udemy ► https://codinghelmet.com/go/udemy

Additional videos:
The Fastest Way to Modify a List in C# ► https://youtu.be/0oSN65eM-tc
Coding with GitHub Copilot – Beginner to Master ► https://youtu.be/B9DKv09IfT4
Want to Start with DDD? Try Ubiquitous Language First! ► https://youtu.be/_zWMjMUHinc
Using C# Record Types ► https://youtu.be/VouNkrgkH78
Covariance and Contravariance in C# ► https://youtu.be/Wp5iYQqHspg
How do Virtual Functions Work? ► https://youtu.be/b0IDTWoaUJ0

Practical Design playlist at YouTube ► https://youtube.com/playlist?list=PLSDYwLgFqaX78eEg_YKs0wHmOMi7_ggZr

#oop #dotnet #functionalprogramming

Comments are closed.