pull/9967/head
Deanna Garcia 3 years ago
parent 448d421250
commit 4049efc7b0
  1. 34
      csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs

@ -120,24 +120,24 @@ namespace Google.Protobuf.WellKnownTypes
return true;
}
/// <summary>
/// Attempts to unpack the content of this Any message into one of the message types
/// in the given type registry, based on the type URL.
/// </summary>
/// <param name="registry">The type registry to consult for messages.</param>
/// <summary>
/// Attempts to unpack the content of this Any message into one of the message types
/// in the given type registry, based on the type URL.
/// </summary>
/// <param name="registry">The type registry to consult for messages.</param>
/// <returns>The unpacked message, or <c>null</c> if no matching message was found.</returns>
public IMessage Unpack(TypeRegistry registry)
{
string typeName = GetTypeName(TypeUrl);
MessageDescriptor descriptor = registry.Find(typeName);
if (descriptor == null)
{
return null;
}
var message = descriptor.Parser.CreateTemplate();
message.MergeFrom(Value);
return message;
public IMessage Unpack(TypeRegistry registry)
{
string typeName = GetTypeName(TypeUrl);
MessageDescriptor descriptor = registry.Find(typeName);
if (descriptor == null)
{
return null;
}
var message = descriptor.Parser.CreateTemplate();
message.MergeFrom(Value);
return message;
}
/// <summary>

Loading…
Cancel
Save