S
SleepSheep
two struct in c#
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi)]
public class A
{
int i1;
byte i2;
}
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi)]
public class B
{
[MarshalAs( UnmanagedType.ByValArray, SizeConst=25 )]
A[] a;
}
then i call Marshal.SizeOf(typeof(B)) will exception and talk me
{"Type B can not be marshaled as an unmanaged structure; no meaningful
size or offset can be computed." }
How to get the size when a struct array in aother struct ?
Thanks
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi)]
public class A
{
int i1;
byte i2;
}
[StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi)]
public class B
{
[MarshalAs( UnmanagedType.ByValArray, SizeConst=25 )]
A[] a;
}
then i call Marshal.SizeOf(typeof(B)) will exception and talk me
{"Type B can not be marshaled as an unmanaged structure; no meaningful
size or offset can be computed." }
How to get the size when a struct array in aother struct ?
Thanks