diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2017-11-09 18:33:15 +0100 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2017-11-10 09:01:32 +0100 |
commit | 5f961914594abed32180d3c664cc04fe5f7b242c (patch) | |
tree | a3dd0bd5d704d46d519ddddca81fd3e463f132a8 /csharp | |
parent | 4a5e1bd043c8ed01b172ca0ad91af00ed45b0640 (diff) | |
download | protobuf-5f961914594abed32180d3c664cc04fe5f7b242c.tar.gz protobuf-5f961914594abed32180d3c664cc04fe5f7b242c.tar.bz2 protobuf-5f961914594abed32180d3c664cc04fe5f7b242c.zip |
ParseFrom<T> for array slice is missing
Diffstat (limited to 'csharp')
-rw-r--r-- | csharp/src/Google.Protobuf/MessageParser.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/MessageParser.cs b/csharp/src/Google.Protobuf/MessageParser.cs index e5334591..66d44135 100644 --- a/csharp/src/Google.Protobuf/MessageParser.cs +++ b/csharp/src/Google.Protobuf/MessageParser.cs @@ -209,6 +209,20 @@ namespace Google.Protobuf } /// <summary> + /// Parses a message from a byte array slice. + /// </summary> + /// <param name="data">The byte array containing the message. Must not be null.</param> + /// <param name="offset">The offset of the slice to parse.</param> + /// <param name="length">The length of the slice to parse.</param> + /// <returns>The newly parsed message.</returns> + public new T ParseFrom(byte[] data, int offset, int length) + { + T message = factory(); + message.MergeFrom(data, offset, length); + return message; + } + + /// <summary> /// Parses a message from the given byte string. /// </summary> /// <param name="data">The data to parse.</param> |