Last time I checked, .NET has some problem dealing with nested structs. I'm not sure whether it's fixed. If it hasn't, you would have to deal with it by yourself. E.g: Allocate a memory block with Marshal.AllocHGlobal, get the struct data, and then use Marshal.PtrToStructure to extract the struct.

解决方案 »

  1.   

    谢谢这么多人来关注,昨晚有事,没有及时上来,很抱歉。
    特别感谢 qqchen79(知秋一叶) ,但是对于这样的结构,在我要调用的DLL中还有很多,如果都要去修改的话,工作量将相当的大,并且容易出错,有没有其它的办法呢?
      

  2.   

    Well, there IS a dirty solution to the problem:[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
    public struct tcsApnPoolList_t
    {
      public tcsApnPool_t apnPoolList1;
      public tcsApnPool_t apnPoolList2;
      public tcsApnPool_t apnPoolList3;
      ...
      public tcsApnPool_t apnPoolList10;    //define 10 items separately.  public System.UInt16 length;
    }