I have the following code:
while (!isCancellationRequested)
{
byte[] frameBytes = socket.ReceiveFrameBytes();
MyData data = new MyData();
data.Deserialize(frameBytes);
// send the data somewhere somehow...
}
What I want to do, but I can't find in the documentation is something that will avoid the creation of new byte array on each socket.Receive
:
byte[] frameBytes = new byte[123];
while (!isCancellationRequested)
{
socket.ReceiveFrameBytes(frameBytes);
MyData data = new MyData();
data.Deserialize(frameBytes);
// send the data somewhere somehow...
}
How can I do that?