From 5f961914594abed32180d3c664cc04fe5f7b242c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 9 Nov 2017 18:33:15 +0100 Subject: ParseFrom for array slice is missing --- csharp/src/Google.Protobuf/MessageParser.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'csharp') 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 @@ -208,6 +208,20 @@ namespace Google.Protobuf return message; } + /// + /// Parses a message from a byte array slice. + /// + /// The byte array containing the message. Must not be null. + /// The offset of the slice to parse. + /// The length of the slice to parse. + /// The newly parsed message. + public new T ParseFrom(byte[] data, int offset, int length) + { + T message = factory(); + message.MergeFrom(data, offset, length); + return message; + } + /// /// Parses a message from the given byte string. /// -- cgit v1.2.3