How To Create Smart Enums in C# With Rich Behavior

Published: 08 November 2022
on channel: Milan Jovanović
54,771
2k

Get the source code for this video for FREE → https://the-dotnet-weekly.ck.page/sma...
☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code:   / milanjovanovic  

Enums are a great way to improve readability in your code. But enums in C# have a minor problem - you can't add behavior to enum elements. You can only work with enum values. In this, I will show you how you can create a custom smart enum implementation that can contain behavior.

Join my weekly .NET newsletter:
https://www.milanjovanovic.tech

Read my Blog here:
https://www.milanjovanovic.tech/blog

Subscribe for more:
https://www.youtube.com/c/MilanJovano...

Chapters
0:00 The problem with C# enums
1:16 Creating the Enumeration class
5:11 Implementing Enumeration in CreditCard
8:44 Completing Enumeration implementation
13:17 Adding logic to CreditCard enum


Watch video How To Create Smart Enums in C# With Rich Behavior online without registration, duration hours minute second in high quality. This video was added by user Milan Jovanović 08 November 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 54,771 once and liked it 2 thousand people.