Skip to content

Commit

Permalink
Make the MergeFrom method of type ReadOnlySequence<byte> public (#11124)
Browse files Browse the repository at this point in the history
(Edited by jskeet) For public release notes:

Add a public `IMessage.MergeFrom(ReadOnlySequence<byte>)` extension method, exposing existing internal functionality.
(Parsing a completely new message from `ReadOnlySequence<byte>` was already publicly available, just not merging.)

----
Public the `MergeFrom` method of type `ReadOnlySequence<byte>`.

We found that the `MergeFrom` method of type `ReadOnlySequence<byte>` is internal.

**We need it !!!**

Closes #11124

COPYBARA_INTEGRATE_REVIEW=#11124 from VAllens:patch-1 0ddea03
PiperOrigin-RevId: 504575534
  • Loading branch information
VAllens authored and copybara-github committed Jan 25, 2023
1 parent 3774ee0 commit c4bac67
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions csharp/src/Google.Protobuf/MessageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public static void MergeFrom(this IMessage message, Stream input) =>
public static void MergeFrom(this IMessage message, ReadOnlySpan<byte> span) =>
MergeFrom(message, span, false, null);

/// <summary>
/// Merges data from the given sequence into an existing message.
/// </summary>
/// <param name="message">The message to merge the data into.</param>
/// <param name="sequence">Sequence from the specified data to merge, which must be protobuf-encoded binary data.</param>
[SecuritySafeCritical]
public static void MergeFrom(this IMessage message, ReadOnlySequence<byte> sequence) =>
MergeFrom(message, sequence, false, null);

/// <summary>
/// Merges length-delimited data from the given stream into an existing message.
/// </summary>
Expand Down

0 comments on commit c4bac67

Please sign in to comment.