diff options
Diffstat (limited to 'csharp/src/Google.Protobuf/JsonParser.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/JsonParser.cs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/csharp/src/Google.Protobuf/JsonParser.cs b/csharp/src/Google.Protobuf/JsonParser.cs index 9e1c83cc..b4a35d7c 100644 --- a/csharp/src/Google.Protobuf/JsonParser.cs +++ b/csharp/src/Google.Protobuf/JsonParser.cs @@ -555,14 +555,10 @@ namespace Google.Protobuf /// <summary> /// Creates a new instance of the message type for the given field. - /// This method is mostly extracted so we can replace it in one go when we work out - /// what we want to do instead of Activator.CreateInstance. /// </summary> private static IMessage NewMessageForField(FieldDescriptor field) { - // TODO: Create an instance in a better way ? - // (We could potentially add a Parser property to MessageDescriptor... see issue 806.) - return (IMessage) Activator.CreateInstance(field.MessageType.GeneratedType); + return field.MessageType.Parser.CreateTemplate(); } private static T ParseNumericString<T>(string text, Func<string, NumberStyles, IFormatProvider, T> parser, bool floatingPoint) |