Implement List<T>.Slice (#75383)
authorFred Silberberg <frsilb@microsoft.com>
Thu, 15 Sep 2022 15:54:23 +0000 (08:54 -0700)
committerGitHub <noreply@github.com>
Thu, 15 Sep 2022 15:54:23 +0000 (16:54 +0100)
commit41deb73d94da51ede96705591237b14948558115
tree8bb37f231c2aba349b43c292920f018b76e4fe76
parent6b2349ae11961a94c299b4984c385976185f0925
Implement List<T>.Slice (#75383)

* Implement List<T>.Slice

Closes https://github.com/dotnet/runtime/issues/66773. I took the approach of just redirecting to GetRange, and using a Theory to make all direct GetRange tests run on both GetRange and Slice (and used list pattern syntax for the Slice version to make sure that's working end-to-end).

* PR feedback.

* Correct parameter names

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
src/libraries/System.Collections/ref/System.Collections.cs
src/libraries/System.Collections/tests/Generic/List/List.Generic.Tests.Misc.cs
src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs