PR feedback

pull/14272/head
James Newton-King 1 year ago
parent 00f0f52420
commit 6ec3ebc2f6
No known key found for this signature in database
GPG Key ID: A66B2F456BF5526
  1. 5
      csharp/src/Google.Protobuf/JsonFormatter.cs

@ -970,10 +970,7 @@ namespace Google.Protobuf
Justification = "The field for the value must still be present. It will be returned by reflection, will be in this collection, and its name can be resolved.")] Justification = "The field for the value must still be present. It will be returned by reflection, will be in this collection, and its name can be resolved.")]
internal static string GetOriginalName(object value) internal static string GetOriginalName(object value)
{ {
Dictionary<object, string> nameMapping = dictionaries.GetOrAdd(value.GetType(), static t => Dictionary<object, string> nameMapping = dictionaries.GetOrAdd(value.GetType(), static t => GetNameMapping(t));
{
return GetNameMapping(t);
});
// If this returns false, originalName will be null, which is what we want. // If this returns false, originalName will be null, which is what we want.
nameMapping.TryGetValue(value, out string originalName); nameMapping.TryGetValue(value, out string originalName);

Loading…
Cancel
Save