Open
Description
I have a usecase where allocations need to be minimized and there are scenarios where I get a T[]
as an input that needs to be converted to either NameValueEntry[]
or HashEntry[]
before I can invoke StreamAdd() or HashSet().
One way to tackle this would be to create a buffer using the ArrayPool e.g.
T[] incoming = ...
NameValueEntry[] buffer = ArrayPool<NameValueEntry>.Shared.Rent(incoming.Length)
// copy the items from incoming to buffer
db.StreamAdd(key, buffer);
However given that the buffer.Length
returned by the pool is not necessarily same as the requested incoming.Length
there is no way for me to indicate how many items StreamAdd()/HashSet() should take.
Would it be possible to create an overload which could support this?