المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : sizeof struct with array



C# Programming
11-06-2009, 10:01 AM
Hi
I would like to define a struct with array of int
I define the struct as below

The problem is that when I want to get the size of the struct, i'm getting it without the array size

such as
sNDIS_802_16E_ACTIVE m_NDIS_802_16E_ACTIVE;
m_NDIS_802_16E_ACTIVE = new sNDIS_802_16E_ACTIVE(20,20);


int size = Marshal.SizeOf(m_NDIS_802_16E_ACTIVE);
public struct sNDIS_802_16E_ACTIVE
{

public UInt32 NaplistLength;
public UInt32[] Nap;
public UInt32 NsplistLength;
public UInt32[] Nsp;
public byte [] aaa;

public sNDIS_802_16E_ACTIVE(UInt32 maxNSP_NAPSize, UInt32 maxNSP_NAPsize)
{

Nap = new UInt32[maxNSP_NAPSize];
Nsp = new UInt32[maxNSP_NAPSize];
NaplistLength = 0;
NsplistLength = 0;
}
} ;


please advice

ronen