Skip to content

Commit c086546

Browse files
committed
Reuse propertyDictionary variable
1 parent 8b50bfb commit c086546

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Nest/CommonAbstractions/Extensions/TypeExtensions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,9 @@ internal static IList<JsonProperty> GetCachedObjectProperties(this Type t, Membe
120120
IList<JsonProperty> propertyDictionary;
121121
if (_cachedTypeProperties.TryGetValue(t, out propertyDictionary))
122122
return propertyDictionary;
123-
124-
var properties = _jsonContract.PropertiesOfAll(t, memberSerialization);
125-
_cachedTypeProperties.TryAdd(t, properties);
126-
return properties;
123+
propertyDictionary = _jsonContract.PropertiesOfAll(t, memberSerialization);
124+
_cachedTypeProperties.TryAdd(t, propertyDictionary);
125+
return propertyDictionary;
127126
}
128-
129127
}
130128
}

0 commit comments

Comments
 (0)