ardalis / GuardClauses

A simple package with guard clause extensions.
MIT License
3.06k stars 270 forks source link

Add Guard for SmartEnums out of range. #346

Open MarkLFT opened 4 months ago

MarkLFT commented 4 months ago

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

ardalis commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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?