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 overloads that don't have parameterName parameter #64

Closed
NRKirby opened this issue Apr 29, 2020 · 3 comments
Closed

Add overloads that don't have parameterName parameter #64

NRKirby opened this issue Apr 29, 2020 · 3 comments

Comments

@NRKirby
Copy link

NRKirby commented Apr 29, 2020

I noticed that all of the examples in the README use the same parameterName as the input. I wonder if most often athis library will be used like this, with the same parameterName as input (and therefore a lot of duplication).

A simpler approach might be to have overloads for each method in GuardClauses.cs that don't have the parameterName parameter, and uses the nameof the input.

I just forked the repo and have an example of what I mean in this commit

With that in mind, would you accept a pull request which adds an overload with a simpler signature for each of the methods in the library?

If you would, I will happily do one!

Nick

@ardalis
Copy link
Owner

ardalis commented Apr 29, 2020

I commented on your commit. If you can make it work so it's not always just the argument name within GuardClauses (but the actual argument name being checked) I'd gladly accept such a PR.

@NRKirby
Copy link
Author

NRKirby commented Apr 29, 2020

Ah I think I was a bit hasty on this.

This seems so obvious now (I must confess I didn't actually run the code). I will have a think about if this is possible although I'm sure you've been thinking about this a lot longer and harder than I have!

@ardalis
Copy link
Owner

ardalis commented Apr 29, 2020

No worries, it's definitely a worthwhile idea to pursue! Cheers.

@ardalis ardalis closed this as completed Apr 29, 2020
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