Methods FromName() and TryFromName() for SmartFlagEnum do not work with ignore case at true
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 184
- PR merge metrics
- No merged PRs in 30d
Description
With the example of EmployeeType in documentation, when using .FromName (ou .TryFromName) with the ignore case flag, no value is returned.
`IEnumerable types = EmployeeType.FromName("director, manager", true);`
The issue is due to the method TryGetFlagEnumValuesByName in SmartFlagEnumExtensions: The BinarySearch on the array should use a System.Collections.CaseInsensitiveComparer as third parameter in this scenario.
Contributor guide
Research direction
Start with TryGetFlagEnumValuesByName in SmartFlagEnumExtensions and reproduce the EmployeeType.FromName("director, manager", true) example from the documentation. Check the case-insensitive lookup path and verify that both FromName and TryFromName return the expected values when ignore case is true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100