I've got a byte array that I want to re-interpret as an array of blittable structs, ideally without copying. Using unsafe code is fine. I know the number of bytes, and the number of structs that I want to get out at the end.
public struct MyStruct
{
public uint val1;
public uint val2;
// yadda yadda yadda....
}
byte[] structBytes = reader.ReadBytes(byteNum);
MyStruct[] structs;
fixed (byte* bytes = structBytes)
{
structs = // .. what goes here?
// the following doesn't work, presumably because
// it doesnt know how many MyStructs there are...:
// structs = (MyStruct[])bytes;
}