aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
index e599998e..65040e42 100644
--- a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
@@ -67,11 +67,13 @@ namespace Google.Protobuf.Reflection
private readonly IList<OneofDescriptor> oneofs;
// CLR representation of the type described by this descriptor, if any.
private readonly Type generatedType;
+ private readonly MessageParser parser;
internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex, GeneratedCodeInfo generatedCodeInfo)
: base(file, file.ComputeFullName(parent, proto.Name), typeIndex)
{
this.proto = proto;
+ parser = generatedCodeInfo == null ? null : generatedCodeInfo.Parser;
generatedType = generatedCodeInfo == null ? null : generatedCodeInfo.ClrType;
containingType = parent;
@@ -123,6 +125,15 @@ namespace Google.Protobuf.Reflection
public Type GeneratedType { get { return generatedType; } }
/// <summary>
+ /// A parser for this message type.
+ /// </summary>
+ /// <remarks>
+ /// As <see cref="MessageDescriptor"/> is not generic, this cannot be statically
+ /// typed to the relevant type, but if <see cref="GeneratedType"/> returns a non-null value, the parser returned
+ /// </remarks>
+ public MessageParser Parser { get { return parser; } }
+
+ /// <summary>
/// Returns whether this message is one of the "well known types" which may have runtime/protoc support.
/// </summary>
internal bool IsWellKnownType