-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 CollectionsMarshal.SetCount(list, count) #82146
Conversation
Adds the ability to resize lists, exposed in CollectionsMarshal due to potentially risky behaviour caused by the lack of element initialization. Supersedes dotnet#77794. Fixes dotnet#55217.
Note regarding the 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. |
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsAdds the ability to resize lists, exposed in Supersedes #77794. Fixes #55217.
|
@stephentoub to see if you still have any open questions. |
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs
Show resolved
Hide resolved
@MichalPetryka could you take a look at the latest review feedback please? Thanks. |
Ah sorry, sure, forgot about this. |
....Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/CollectionsMarshalTests.cs
Show resolved
Hide resolved
static void SequenceEquals<T>(ReadOnlySpan<T> actual, ReadOnlySpan<T> expected) | ||
{ | ||
Assert.Equal(actual.Length, expected.Length); | ||
|
||
for (int i = 0; i < actual.Length; i++) | ||
{ | ||
Assert.Equal(actual[i], expected[i]); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a helper for this in AssertExtensions:
public static void SequenceEqual<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual) where T : IEquatable<T> |
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.