Рет қаралды 53,414
Get the source code for this video for FREE → the-dotnet-wee...
☄️ Master the Modular Monolith Architecture: bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: 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:
www.milanjovan...
Read my Blog here:
www.milanjovan...
Subscribe for more:
www.youtube.co...
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