无法获取的地址,获取的大小,或者声明指向一个托管类型(“类型名称”) [英] Cannot take the address of, get the size of, or declare a pointer to a managed type ('type name')
本文介绍了无法获取的地址,获取的大小,或者声明指向一个托管类型(“类型名称”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此错误停止编译,如果我有一个或多个System.String在我的结构
有存储字符串任何其他方式?
this error stops compiling if i have one or more System.String in my structs
is there any other way to store strings?
我已经试过这样的事情:
i have tried things like this:
private long _B_ID;
private byte[] _C_Name;
private byte[] _C_Address;
private byte[] _C_Telephone;
,但它不似乎工作
but it is not seeming to work.
推荐答案
您只能得到一个结构的地址,如果是blittable,也就是说,它不包含引用。
请参见 Blittable和非Blittable型(MSDN)
You can only get the address of a struct if it is blittable, i.e. it doesn't contain references.
See Blittable and Non-Blittable Types(MSDN)
这篇关于无法获取的地址,获取的大小,或者声明指向一个托管类型(“类型名称”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文