Skip to content

Conversation

@ColmBhandal
Copy link
Owner

Description

Refactored various indexing functions on the IEnumerable extension and the OneBasedArray class to disambiguate between zero-based and one-based indexing.

@ColmBhandal ColmBhandal linked an issue Nov 4, 2021 that may be closed by this pull request
public static int FirstIndexOfZeroBased<T>(this IEnumerable<T> values, T value) =>
values.FirstIndexOf(value, 0);

public static int FirstIndexOf<T>(this IEnumerable<T> values, T value, int startIndex)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The name startIndex is a bit confusing in this context. At first glace I thought it was the index where the search starts (i.e. if you say the start index is 5, it will start looking for a match at position 5 of the array).

StartIndex can confuse the user that it's the index at which to start the search
@ColmBhandal ColmBhandal merged commit 2c394d3 into develop Nov 4, 2021
@ColmBhandal ColmBhandal deleted the feature/90-disambiguate-first-index-of branch November 4, 2021 12:01
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.

Disambiguate FirstIndexOf for OneBasedArray

3 participants