aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2017-11-09 18:33:15 +0100
committerGravatar Jan Tattermusch <jtattermusch@google.com>2017-11-09 18:33:15 +0100
commit30b6e543277901fb95373138d358ae5d53048977 (patch)
treecb4690745792cad35e603cd41bdfd586eafd182e /csharp
parent07542e78da48372c856c4b555698e5646919d764 (diff)
ParseFrom<T> for array slice is missing
Diffstat (limited to 'csharp')
-rw-r--r--csharp/src/Google.Protobuf/MessageParser.cs14
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>