Skip to content
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

Share common code involved into building dictionaries of members for namespace symbols #67933

Merged
merged 8 commits into from
Apr 26, 2023
Prev Previous commit
Next Next commit
AddToMultiValueDictionaryBuilder - extract common code out of if`
  • Loading branch information
AlekseyTs committed Apr 23, 2023
commit 32823f93baa3582b6c9dc7c35b4957fe482c59b9
Original file line number Diff line number Diff line change
Expand Up @@ -887,16 +887,16 @@ internal static void AddToMultiValueDictionaryBuilder<K, T>(Dictionary<K, object
if (existingValueOrArray is ArrayBuilder<T> arrayBuilder)
{
// Already a builder in the accumulator, just add to that.
arrayBuilder.Add(item);
}
else
{
// Just a single value in the accumulator so far. Convert to using a builder.
arrayBuilder = ArrayBuilder<T>.GetInstance(capacity: 2);
arrayBuilder.Add((T)existingValueOrArray);
arrayBuilder.Add(item);
accumulator[key] = arrayBuilder;
}

arrayBuilder.Add(item);
}
else
{
Expand Down