-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Unable to use OutOfRange<T> with decimal types #46
Comments
Hello! Something like: I can put in a PR for the above if needed. :) |
@KyleMcMaster what if you need for some other type in future? Instead of keep adding new extension making it public would help right? |
@fingers10 It appears |
again what about |
The current pattern followed by other guards as well is to keep the generic helper private and write concrete non-generic public extension methods. I think while this means writing a little more code it provides an opportunity to vary the behavior if needed in the specific extension instead of adding conditional logic to the generic method. So, I think I’ll keep the generic method private but will take PRs for whatever concrete types are needed. |
Dear Steve,
I'm not able to use
OutOfRange
for decimal types likeGuard.Against.OutOfRange(unitPrice, nameof(unitPrice), 0, decimal.MaxValue);
when I checked the source code, I can see thatOutOfRange
is markedprivate
. Please can you change that topublic
? This could help to use it with many types. Correct me if I'm wrong.Thanks,
Abdul
The text was updated successfully, but these errors were encountered: