Hello. *background:* Protocol Buffers for C# supports powerful reflections, and they provide flexiblity for message handling. But, except prebuilt parsers such as a JSON, creating new message instance dynamically requires troublesome and slow way.
var messageDescriptor = GetSomeMessageDescriptor(); var message = Activator.CreateInstance(messageDescriptor.ClrType) as SomeMessage; And unpacking Any instance with MessageDescriptor is more difficult. This is in contrast to type validation by Any.Is(MessageDescriptor) requires MessageDescriptor. *proposal:* 1. *make public **MessageParser.CreateTemplate()* Already MessageParser class has CreateTemplate() method to build default instance, but it is internal. I propose to change it into public directly, or implement public proxy method into MessageDescriptor. var messageDescriptor = GetSomeMessageDescriptor(); IMessage message = messageDescriptor.CreateTemplate(); 2. *add Any.TryUnpack(MessageDescriptor, out IMessage) method* I propose to provide new way to unpack `Any` without closed generic type argument. var any = GetSomeAny(); var messageDescriptor = GetSomeMessageDescriptor(); any.TryUnpack(messageDescriptor, out IMessage unpacked); Thanks a lot. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/36965da0-f3fc-416e-b1ba-1a31338c8f25n%40googlegroups.com.
