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

Experimental idea: IsBetween with explicit Inclusive and Exlusive boundaries #783

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FreeApophis
Copy link
Member

Main Idea:

I want a "IsBetween" extension on number types (just int in the experiment) which I can chose if the boundary are inclusive or exclusive.

12.IsBetween<Including, Excluding>(0, 20)

This was a lot easier than I thought, I defined a common interface IIntervalBoundary and two implementations Inclusive and Exclusive with private constructors and public implicit operators.

{
var position = 12;

Assert.True(position.IsBetween<Including, Excluding>(20, 0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea: InRange instead of IsBetween

@FreeApophis FreeApophis changed the title Experimental idea: IsBetween with explicit Inclusive and Exlusive boundatries Experimental idea: IsBetween with explicit Inclusive and Exlusive boundaries Apr 16, 2024
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

Successfully merging this pull request may close these issues.

2 participants