Introduce GetAll() method
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 184
- PR merge metrics
- No merged PRs in 30d
Description
I noticed that there is no 'GetAll()' method for this, as described on this page:
https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/enumeration-classes-over-enum-types
Could this be added to the base class?
```
///
/// Retrieve all enumerations of the SmartEnum
///
/// new of type
///
public static IEnumerable GetAll() =>
typeof(T).GetFields(System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.DeclaredOnly)
.Select(f => f.GetValue(null))
.Cast();
```
This should get all of the static enum values defined
Contributor guide
Research direction
Start by locating the SmartEnum base class and reviewing how its static values are currently represented and tested. Use the proposed GetAll() behavior in the issue as the target: callers should receive all static enum values defined on the concrete type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100