Skip to content

Commit 013d5c9

Browse files
committed
Workaround for missing interfaces on ArraySegment in NET40.
1 parent eb79fb1 commit 013d5c9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • Provider/src/FirebirdSql.Data.FirebirdClient/Client/Managed

Provider/src/FirebirdSql.Data.FirebirdClient/Client/Managed/XdrStream.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,15 @@ public override void Write(byte[] buffer, int offset, int count)
266266
CheckDisposed();
267267
EnsureWritable();
268268

269+
#if NET40
270+
_outputBuffer.Capacity = Math.Max(_outputBuffer.Capacity, _outputBuffer.Count + count);
271+
for (var i = offset; i < count; i++)
272+
{
273+
_outputBuffer.Add(buffer[i]);
274+
}
275+
#else
269276
_outputBuffer.AddRange(new ArraySegment<byte>(buffer, offset, count));
277+
#endif
270278
}
271279

272280
public byte[] ToArray()

0 commit comments

Comments
 (0)