Skip to content

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
@tautropfli tautropfli closed this Feb 15, 2025
@tautropfli tautropfli deleted the experimental-is-between branch February 15, 2025 15:13
@tautropfli tautropfli restored the experimental-is-between branch February 15, 2025 15:20
@tautropfli
Copy link
Member

Sorry for the noise, I was too eager in deleting branches 🙈

@tautropfli tautropfli reopened this Feb 15, 2025
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.

4 participants