I have an api call which needs to get a byte[] as parameter and my data already is in a byte[]. The problem is that I want to send this buffer in little chunks.
The slow solution would be to copy the array data to new arrays. But I don’t want to do this because copying is unnecessary. I just want a byte[]-pointer which i can move around in my buffer. Like in C or C++…
Here a sample in pseudo code:
ArrayOriginal = { 0, 1, 2, 3, 4, ... 100 }
ArrayFirstChunk = { 0, 1, 2 } (pointer to the first element in the Original Array)
ArraySecondChunk = { 3, 4, 5 } (pointer to the fourth element in the Original Array)
…
Is this possible? The data shall be available only one time in the memory.
thx
You don’t say whether you can change the API. I assume not, but if you can, there is always
IEnumerable<byte>– so you returnetc