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-10 09:01:32 +0100
commit5f961914594abed32180d3c664cc04fe5f7b242c (patch)
treea3dd0bd5d704d46d519ddddca81fd3e463f132a8 /csharp
parent4a5e1bd043c8ed01b172ca0ad91af00ed45b0640 (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>