Skip to content

Commit b626f16

Browse files
authored
Special the capacity to improve performance (#3086)
1 parent 5fb45a4 commit b626f16

File tree

1 file changed

+2
-2
lines changed
  • src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows

1 file changed

+2
-2
lines changed

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/NameScope.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public ICollection<string> Keys
294294
return null;
295295
}
296296

297-
var list = new List<string>();
297+
var list = new List<string>(_nameMap.Keys.Count);
298298
foreach (string key in _nameMap.Keys)
299299
{
300300
list.Add(key);
@@ -312,7 +312,7 @@ public ICollection<object> Values
312312
return null;
313313
}
314314

315-
var list = new List<object>();
315+
var list = new List<object>(_nameMap.Values.Count);
316316
foreach (object value in _nameMap.Values)
317317
{
318318
list.Add(value);

0 commit comments

Comments
 (0)