How I can declare arrays in struct?
How can I declare structure with a fixed size array in it? I found solution, but it only works for primitive data-types. I need my array to be of type MyStruct . So how can I declare a struct with an array of other structs in it? ex. unsafe struct Struct1{ fixed int arrayInt[100]; // works properly fixed Struct2 arrayStruct[100]; //not compile } My colleague found the working way to do this. I think it`s right way. [StructLayout(LayoutKind.Sequential)] public struct Struct1 { [MarshalAs(UnmanagedType.ByValArray, SizeConst = sizeOfarray)] private Struct2[] arrayStruct; } You can't. Fixed arrays