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
{{ message }}
Repository navigation
Extend AcceptOnlyFromAmong with bool ignoreCase = false #2254
After thinking about this a bit more, I'm not sure the solution proposed in this issue title is the best approach. The core of the problem is that the validation and the parsing have different casing rules. If the API could ensure they're aligned, it would be less error-prone without having to add complexity. On the other hand, making this configurable could open the door to the opposite inconsistency, e.g. someone has case-sensitive parsing but case-insensitive validation.
We're redesigning the validation APIs and we should consider this in the redesign.
Activity
KalleOlaviNiemitalo commentedon Jul 31, 2023
Case-insensitive Enum.Parse uses OrdinalIgnoreCase comparison, rather than culture-dependent: https://github.com/dotnet/runtime/blob/a08d9ce2caf02455c0b825bcdc32974bdf769a80/src/libraries/System.Private.CoreLib/src/System/Enum.cs#L921
jonsequitur commentedon Jul 31, 2023
After thinking about this a bit more, I'm not sure the solution proposed in this issue title is the best approach. The core of the problem is that the validation and the parsing have different casing rules. If the API could ensure they're aligned, it would be less error-prone without having to add complexity. On the other hand, making this configurable could open the door to the opposite inconsistency, e.g. someone has case-sensitive parsing but case-insensitive validation.
We're redesigning the validation APIs and we should consider this in the redesign.