diff --git a/src/ProtocolBuffers/ByteString.cs b/src/ProtocolBuffers/ByteString.cs index 545bf556c8..ea17ca1ee6 100644 --- a/src/ProtocolBuffers/ByteString.cs +++ b/src/ProtocolBuffers/ByteString.cs @@ -252,7 +252,10 @@ namespace Google.ProtocolBuffers } } - internal void WriteTo(CodedOutputStream outputStream) + /// + /// Used internally by CodedOutputStream to avoid creating a copy for the write + /// + internal void WriteRawBytesTo(CodedOutputStream outputStream) { outputStream.WriteRawBytes(bytes, 0, bytes.Length); } diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs index 59490df3b4..088db8ae62 100644 --- a/src/ProtocolBuffers/CodedOutputStream.cs +++ b/src/ProtocolBuffers/CodedOutputStream.cs @@ -360,7 +360,7 @@ namespace Google.ProtocolBuffers { WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); WriteRawVarint32((uint) value.Length); - value.WriteTo(this); + value.WriteRawBytesTo(this); } [CLSCompliant(false)] @@ -637,7 +637,7 @@ namespace Google.ProtocolBuffers public void WriteBytesNoTag(ByteString value) { WriteRawVarint32((uint) value.Length); - value.WriteTo(this); + value.WriteRawBytesTo(this); } [CLSCompliant(false)]