日期:2014-05-20  浏览次数:20982 次

求:c#结构体内数组以及结构体嵌套
/*结构体原型
typedef   struct   {  
unsigned   int   s;
unsigned   int   d;  
unsigned   int   SP[4][4];
}   A;

typedef   struct   {  
unsigned   char   mv;    
unsigned   char   n;    
B   sb;    
unsigned   int   cn;    
unsigned   int   Seg[8];    
int*   r1;  
unsigned   char*   r2[512];  
}   B;  

*/
用C#怎么写


------解决方案--------------------
沙发先
------解决方案--------------------
指针的还不知道怎么表示,但是类型嵌套应是如下的样式:

struct b
{
public char mv;
public char n;
public b sp;
public int cn;
public int[] Seg=new int[8];
...
}

------解决方案--------------------
struct不是很好写,要用到Invoke的那种写法
简单的方法就是把struct当成class来写
------解决方案--------------------
public int[] Seg=new int[8];
struct中不能有new 不能赋值
------解决方案--------------------
public int[8] Seg;

------解决方案--------------------
public int[8] Seg;
一样报错 不能这么写
要用到那个[Mar..]什么的忘了
------解决方案--------------------
[Marshal]
我是建议把struct当成class来写 反正是一样的调用
指针麻..........,Marshal里好像也有