diff options
Diffstat (limited to 'qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs')
-rw-r--r-- | qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs b/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs index c54272b33f..ea3b11b60d 100644 --- a/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs +++ b/qpid/dotnet/Qpid.Buffer/HeapByteBuffer.cs @@ -126,8 +126,11 @@ namespace Qpid.Buffer } public override byte[] ToByteArray() - { - return _underlyingData; + { + // Return copy of bytes remaining. + byte[] result = new byte[Remaining]; + Array.Copy(_underlyingData, _position, result, 0, Remaining); + return result; } private void CheckSpace(int size) |