构造数组获取地址
结构数组获取地址
struct Point
{ public int x; public int y;}
struct Test{ public Point[] p;}
Test a=new Test();请问如何获取a的地址,如果结构内数组为int型则可以轻松获取,结构数组则不知道怎么取。
------解决方案--------------------
用 unsafe 代码
&a 就是地址
------解决方案--------------------
a.p[0],一样的
就是给封装到结构里了而已
跟放到类里使用起来差不多
struct Point
{ public int x; public int y;}
struct Test{ public Point[] p;}
Test a=new Test();请问如何获取a的地址,如果结构内数组为int型则可以轻松获取,结构数组则不知道怎么取。
------解决方案--------------------
用 unsafe 代码
&a 就是地址
------解决方案--------------------
a.p[0],一样的
就是给封装到结构里了而已
跟放到类里使用起来差不多