I have a static function in my class ExMessage
. The purpose of this function is to split a byte array payload
into smaller chunks and call it constructor for each chunk.Does Take()
return successive bytes of size MAX_PAYLOAD_SIZE
. I tried and it doesn't seem to work.
public static List<ExMessage> CreateMessages(byte[] payload, int sequence_number)
{
if (payload.Length > MAX_PAYLOAD_SIZE)
{
byte[] chunks = payload.Take(MAX_PAYLOAD_SIZE).ToArray();
var Message = new ExMessage(chunks, 1, 1);
List<ExMessage> arr = new List<ExMessage>();
arr.Insert(0,Message);
return arr;
}
}