Skip to content

Commit d8f2f09

Browse files
authored
Pre-size List in TryGetPortableFrameworks to avoid array resize allocations (#7095)
1 parent 849933c commit d8f2f09

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/NuGet.Core/NuGet.Frameworks/FrameworkNameProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ public bool TryGetPortableFrameworks(string shortPortableProfiles, [NotNullWhen(
500500

501501
var shortNames = shortPortableProfiles.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
502502

503-
var result = new List<NuGetFramework>();
503+
var result = new List<NuGetFramework>(shortNames.Length);
504504
foreach (var name in shortNames)
505505
{
506506
var framework = NuGetFramework.Parse(name, this);

0 commit comments

Comments
 (0)