diff options
author | Jon Skeet <skeet@pobox.com> | 2015-11-19 12:36:51 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2015-11-19 12:36:51 +0000 |
commit | ff37edcd8a533b5440dfae541ea85f8b41d94e55 (patch) | |
tree | 0ab0f79a8121e4c8a5d49afc6caae561963f7ed4 /csharp/src/Google.Protobuf/JsonParser.cs | |
parent | c581acb562fad93c4eb7b125cc31b64fa6f51868 (diff) | |
parent | 360feda5f76e62a3a8e5b086bdb3b851f7730f2e (diff) | |
download | protobuf-ff37edcd8a533b5440dfae541ea85f8b41d94e55.tar.gz protobuf-ff37edcd8a533b5440dfae541ea85f8b41d94e55.tar.bz2 protobuf-ff37edcd8a533b5440dfae541ea85f8b41d94e55.zip |
Merge pull request #974 from jskeet/parser
Parser property in MessageDescriptor
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) |