Add MemoryExtensions.Count (#80662)
authorSandro Bollhalder <boli89@gmail.com>
Fri, 27 Jan 2023 20:24:05 +0000 (21:24 +0100)
committerGitHub <noreply@github.com>
Fri, 27 Jan 2023 20:24:05 +0000 (15:24 -0500)
commitddabb6ea8cbdd4af594854e40c1c0ad1f29239e2
treea3fb9fcdd4e267efbd0a0beb8b3904f8b17af76d
parentce9c269e4d8deba2d4328fa2a5251adce74f5eab
Add MemoryExtensions.Count (#80662)

* Add MemoryExtensions.Count

* add test cases

* fix implementation

* fix review comments part I

* more tests

* return 0 if value is Empty

* Address PR feedback

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
src/libraries/System.Memory/System.Memory.sln
src/libraries/System.Memory/ref/System.Memory.cs
src/libraries/System.Memory/tests/ReadOnlySpan/Count.T.cs [new file with mode: 0644]
src/libraries/System.Memory/tests/ReadOnlySpan/Count.byte.cs [new file with mode: 0644]
src/libraries/System.Memory/tests/System.Memory.Tests.csproj
src/libraries/System.Memory/tests/TestHelpers.cs
src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs
src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs