Add CollectionsMarshal.SetCount(list, count) (#82146)
authorMichał Petryka <35800402+MichalPetryka@users.noreply.github.com>
Tue, 25 Apr 2023 01:14:10 +0000 (03:14 +0200)
committerGitHub <noreply@github.com>
Tue, 25 Apr 2023 01:14:10 +0000 (21:14 -0400)
commit01e2455aa538097b489f8ea3560ab483e8d55e76
tree8f16a4535696a27925a859df7b6d7afff93b8088
parent41f6e792f3336b021cfaa4f429752b4cac38d064
Add CollectionsMarshal.SetCount(list, count) (#82146)

* Add CollectionsMarshal.SetCount(list, count)

Adds the ability to resize lists, exposed in
CollectionsMarshal due to potentially risky
behaviour caused by the lack of element initialization.

Supersedes #77794.

Fixes #55217.

* Update XML doc

* Add missing using

* Fix test

* Update CollectionsMarshalTests.cs

* Update CollectionsMarshal.cs

* Update CollectionsMarshalTests.cs

* Update CollectionsMarshalTests.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs
src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/CollectionsMarshalTests.cs