You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* update date, remove casual language
* changes per suggestions
* revert newline only change
* revert newline only change
* revert changes to maintain existing style found in eShopOnContainers
* Apply suggestions from code review
Co-authored-by: David Pine <[email protected]>
Copy file name to clipboardExpand all lines: docs/architecture/microservices/microservice-ddd-cqrs-patterns/enumeration-classes-over-enum-types.md
+17-22Lines changed: 17 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
2
title: Using Enumeration classes instead of enum types
3
3
description: .NET Microservices Architecture for Containerized .NET Applications | Lear how you can use enumeration classes, instead of enums, as a way to solve some limitations of the latter.
4
-
ms.date: 10/08/2018
4
+
ms.date: 11/25/2020
5
5
---
6
6
# Use enumeration classes instead of enum types
7
7
8
8
[Enumerations](../../../csharp/language-reference/builtin-types/enum.md) (or *enum types* for short) are a thin language wrapper around an integral type. You might want to limit their use to when you are storing one value from a closed set of values. Classification based on sizes (small, medium, large) is a good example. Using enums for control flow or more robust abstractions can be a [code smell](https://deviq.com/code-smells/). This type of usage leads to fragile code with many control flow statements checking values of the enum.
9
9
10
10
Instead, you can create Enumeration classes that enable all the rich features of an object-oriented language.
11
11
12
-
However, this isn't a critical topic and in many cases, for simplicity, you can still use regular [enum types](../../../csharp/language-reference/builtin-types/enum.md) if that's your preference. Anyway, the use of enumeration classes is more related to business-related concepts.
12
+
However, this isn't a critical topic and in many cases, for simplicity, you can still use regular [enum types](../../../csharp/language-reference/builtin-types/enum.md) if that's your preference. The use of enumeration classes is more related to business-related concepts.
13
13
14
14
## Implement an Enumeration base class
15
15
@@ -22,29 +22,23 @@ public abstract class Enumeration : IComparable
0 commit comments