Skip to content
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 for SmartEnums out of range. #346

Open
MarkLFT opened this issue May 28, 2024 · 3 comments
Open

Add Guard for SmartEnums out of range. #346

MarkLFT opened this issue May 28, 2024 · 3 comments

Comments

@MarkLFT
Copy link

MarkLFT commented May 28, 2024

It would be good to have an OutOfRange for SmartEnums the same as regular Enums.

@ardalis
Copy link
Owner

ardalis commented May 29, 2024

Agreed. Is it worth its own separate package though? I wouldn't want to force a dependency on SmartEnum into GuardClauses so it would have to exist in a separate (very small) Ardalis.GuardClauses.SmartEnum package.

Or I could just add guards to SmartEnum itself which might make more sense. Thoughts?

@MarkLFT
Copy link
Author

MarkLFT commented May 29, 2024

Personally, when I have been creating class specific guards, I have created a guards folder in class assembly, and put them in there. That way, if you include the class, and the guards come along for the ride. For me, that is just cleaner. But I am not sure if that is breaking any "clean" rules.

@ardalis
Copy link
Owner

ardalis commented May 29, 2024

Right, so this would argue for me adding them to SmartEnum project, not this one? In that case, would you mind creating an issue over there and reference this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants