Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add .Between extension methods #11

DualBrain started this conversation in Ideas
Discussion options

It is very often that you would like to check to see if a value is between two other values. I've been utilizing a set of extension methods that seems to provide a means to ease this as well as provide for an easier to understand implementation...

If value >= minimum AndAlso value <= maximum Then

versus

If value.Between(minimum, maximum) Then

This, of course, requires several overloaded versions; numeric, date, etc. Thoughts?

You must be logged in to vote

Replies: 1 comment

Comment options

DualBrain
Feb 25, 2022
Maintainer Author

Alternatively, would it make sense to make function to handle this (instead of extension methods)?

If Between(value, minimum, maximum) Then

Additional questions...

Would it make sense to call this something else? Should there be two variants where one is truly between (exclusive) and one is within (inclusive)?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #9 on February 25, 2022 18:36.

AltStyle によって変換されたページ (->オリジナル) /