Skip to content

Commit 169d086

Browse files
authored
In FamilyCollection.cs replace Dictionary ContainsKey-Add with TryAdd (#4486)
1 parent 7852ebf commit 169d086

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,7 @@ private static Text.TextInterface.Font GetFontFromFamily(Text.TextInterface.Font
499499
foreach (KeyValuePair<CultureInfo, string> name in font.FaceNames)
500500
{
501501
string currentFontName = name.Value.ToUpper(CultureInfo.InvariantCulture);
502-
if (!faces.ContainsKey(currentFontName))
503-
{
504-
faces.Add(currentFontName, font);
505-
}
502+
faces.TryAdd(currentFontName, font);
506503
}
507504
}
508505

0 commit comments

Comments
 (0)