using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Console.WriteLine(Unsafe.SizeOf<s4>());
// ^^^ 44 = 11 integers, as expected
var obj = new s4();
obj.s2[3] = 13;
Console.WriteLine(obj.s3[3]); // 13
[InlineArray(10)]
public struct s2
{
// this just defines the type for the inline array
private int w;
}
[InlineArray(10)]
public struct s3
{
// this just defines the type for the inline array
private int w;
}
[StructLayout(LayoutKind.Explicit)]
public struct s4
{
[FieldOffset(0)]
int i;
// changed accessibility to test
[FieldOffset(4)]
public s2 s2;
[FieldOffset(4)]
public s3 s3;
}