commit
6da9b69efe
@ -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…
Reference in New Issue
Block a user