-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.7.0
-
Component/s: BSON
-
None
I'd like to reuse one allocated buffer to read and one buffer to write to the mongodb. Currently one must use WriteBytes(byte[]) and byte[] ReadBytes() to read and write byte arrays. These arrays must be pre allocated with the correct size.
If you want to reuse a buffer it would be nice to get some overloads with a size restriction like:
void IBsonWriter.WriteBytes(byte[] bytes, int size);
This overload should only write size bytes to the document.
void IBsonWriter.ReadBytes(byte[] buffer, int offset, int size);
This overload should only fill the count of bytes defined by size starting at offset.
This would reduce memory fragmentation in the program.
- duplicates
-
CSHARP-5125 Implement support for Span<T>
- Backlog