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

Add MemoryExtensions.Count #80662

Merged
merged 7 commits into from
Jan 27, 2023
Merged

Conversation

bollhals
Copy link
Contributor

Closes #59466

Original implementation from @stephentoub.

Testcases added for single values and the same tests for ReadOnlySpans.
Types tested are byte, int, TInt and string.

Test cases are mostly copied / inspired by other similar methods like Contains.

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jan 15, 2023
@dnfadmin
Copy link

dnfadmin commented Jan 15, 2023

CLA assistant check
All CLA requirements met.

@ghost
Copy link

ghost commented Jan 15, 2023

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

Issue Details

Closes #59466

Original implementation from @stephentoub.

Testcases added for single values and the same tests for ReadOnlySpans.
Types tested are byte, int, TInt and string.

Test cases are mostly copied / inspired by other similar methods like Contains.

Author: bollhals
Assignees: -
Labels:

area-System.Memory, new-api-needs-documentation

Milestone: -

@stephentoub
Copy link
Member

Thanks for working on this!

@danmoseley
Copy link
Member

Perhaps it was already mentioned above, but do you plan to follow up with a PR to add test cases to dotnet/performance?

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Thanks!

@stephentoub stephentoub merged commit ddabb6e into dotnet:main Jan 27, 2023
@bollhals bollhals deleted the memoryextensionscount branch January 27, 2023 21:12
@ghost ghost locked as resolved and limited conversation to collaborators Feb 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Memory community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: MemoryExtensions.Count / number of occurrences of a value in a span
7 participants