-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Description:
Could the IBsonWriter interface support adding the following methods to enable better memory allocation avoidance at the upper layer?
void WriteBytes(byte[] bytes, int offset, int length) void WriteBytes(ReadOnlySpan<byte> bytes)
Motivation:Currently, when writing byte data through IBsonWriter, upper-layer code often needs to perform additional memory allocations or array copying operations. Adding these overloads would allow: # Slice-based writing: WriteBytes(bytes, offset, length) enables writing a portion of an existing byte array without creating a new array
- Span-based writing: WriteBytes(ReadOnlySpan<byte>) provides modern, allocation-free API for writing memory segments
- duplicates
-
CSHARP-5709 Support Span based binary writes on the bson writer
-
- Closed
-