-
-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Guard fro SmartEnum Out of Range #528
Comments
Hey, I have read the original discussion.
In any case, the method should check all enum options and find a matching one - it's actually IsDefined. |
My issue with option 1 is that I'm sure many projects already use both Ardalis.SmartEnum and Ardalis.GuardClauses, so the potential for naming conflicts is a problem. Let's say we add a Guard class, would it live in the namespace Ardalis.SmartEnum.Guard (the folder you suggest), and would it use the same extension method approach? If so, what happens if a file includes a using statement for Ardalis.GuardClauses? Now you have to fully qualify the extension method which is ugly. Regarding option 3, I do think that most projects that use SmartEnum quite likely also use GuardClauses, but I wouldn't want to force any consumer to do so. So I agree, not ideal. That leaves your option 2 of just emulating what Microsoft did with their Exception types and add A 4th option would be to create a new package on the SmartEnum side, like Open to more comments/ideas/discussion. |
Plase add a guard for Smart Enums Out of Range, just like a regular enum.
Please refer to original discussion at ardalis/GuardClauses#346 (comment)
The text was updated successfully, but these errors were encountered: