Answers for "c# sequential struct with fixed array size"

C#
0

c# sequential struct with fixed array size

[StructLayout(LayoutKind.Sequential)]
struct Foo
{
    public ushort W;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] X;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
    public Inner[] data;
}
Posted by: Guest on March-28-2022
0

c# sequential struct char array fixed size

struct RECORD {
    char[] name = new char[16];
    int dt1;
}
struct BLOCK {
    char[] version = new char[4];
    int  field1;
    int  field2;
    RECORD[] records = new RECORD[15];
    char[] filler1 = new char[24];
}
Posted by: Guest on March-28-2022

C# Answers by Framework

Browse Popular Code Answers by Language