struct内部的struct指针 [英] struct pointer inside struct

查看:130
本文介绍了struct内部的struct指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经定义了此结构

I have defined this structure

struct TTstruct
        {
            unsafe TTstruct* next; 
            public int[][][] bookings;
            public long cost;
            public long rcc;  
            public long rts;  
            public long ldb;  
            public long lua;  
        };


where方法将指针"TTstruct * next"作为参数,并且我收到此错误消息:
无法获取其地址,获取其大小或声明一个指向托管类型的指针("myNameSpace.SubjectsForm.TTstruct")


wherever method takes the pointer "TTstruct* next" as argument , and I recieve this error message :
Cannot take the address of, get the size of, or declare a pointer to a managed type (''myNameSpace.SubjectsForm.TTstruct'')

How can I solve this?

推荐答案

您是否要在Interop代码中使用它?收到此消息的原因是因为您正在尝试获取不是 blittable [ ^ ]结构.问题在于数组类型的使用-如果您知道它们的大小,则应该可以执行以下操作:
Are you trying to use this in Interop code? The reason you are getting this is because you are trying to get the address of a structure that is not a blittable[^] structure. The problem lies in the use of the array types - if you know their sizes, you should be able to do something like:
public fixed int[6][5][4] bookings;


这篇关于struct内部的struct指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆