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

SortedList<TKey, TValue> added GetKeyAtIndex, GetValueAtIndex, and SetValueAtIndex #60520

Merged
merged 3 commits into from
Nov 15, 2021

Conversation

rhaokiel
Copy link
Contributor

Implemented set value at index method.
Exposed get at index methods.
per approved API Proposal #58962

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Oct 17, 2021
@ghost
Copy link

ghost commented Oct 29, 2021

Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.

Issue Details

Implemented set value at index method.
Exposed get at index methods.
per approved API Proposal #58962

Author: rhaokiel
Assignees: -
Labels:

area-System.Collections, community-contribution

Milestone: -

@eiriktsarpalis
Copy link
Member

Apologies for not looking at this PR, seems like it was missed by the labelling bot. Will get back to you ASAP.

@eiriktsarpalis eiriktsarpalis self-requested a review October 29, 2021 19:06
// Sets the value of the entry at the given index.
public void SetValueAtIndex(int index, TValue value)
{
if (index< 0 || index >= _size)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: indentation

Suggested change
if (index< 0 || index >= _size)
if (index < 0 || index >= _size)

SortedList<TKey, TValue> dictionary = (SortedList<TKey, TValue>)GenericIDictionaryFactory(count);
Assert.All(Enumerable.Range(0, count), index =>
{
Assert.Equal(index, dictionary.IndexOfValue(dictionary.GetValueAtIndex(index)));
Copy link
Member

Choose a reason for hiding this comment

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

I assume this would require unique values, but if the test is passing then I guess it's fine.

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Collections community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants