Skip to content

Commit 17b2f90

Browse files
authored
Unnecessary double allocation in DictionaryTKeyEnumTValueConverter.cs (#40192)
1 parent 55d4438 commit 17b2f90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/standard/serialization/system-text-json/snippets/how-to/csharp/DictionaryTKeyEnumTValueConverter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public override JsonConverter CreateConverter(
2525
Type type,
2626
JsonSerializerOptions options)
2727
{
28-
Type keyType = type.GetGenericArguments()[0];
29-
Type valueType = type.GetGenericArguments()[1];
28+
Type[] typeArguments = type.GetGenericArguments();
29+
Type keyType = typeArguments[0];
30+
Type valueType = typeArguments[1];
3031

3132
JsonConverter converter = (JsonConverter)Activator.CreateInstance(
3233
typeof(DictionaryEnumConverterInner<,>).MakeGenericType(

0 commit comments

Comments
 (0)