【发布时间】:2017-02-09 12:02:48
【问题描述】:
我有一个 Labview interop assembly,它需要 string[* ]、int[* ] 和 customType[*] 用于各种结构和方法。
例如,这是元数据中结构的声明:
public struct AppImage__32Properties
{
...
public FPGA__32Properties[] fPGA__32Properties;
...}
fPGA__32Properties 是一个结构体数组。
现在我想给它分配一个相同类型的空数组 (其实例未初始化),然后继续填充其字段。
AppInfoDummy[0].appImage__32Properties.fPGA__32Properties =
new FPGA__32Properties[1];
但它会导致
"无法将类型 'DeployImage_RAD.FPGA_32Properties[]' 隐式转换为 DeployImage_RAD.FPGA_32Properties[*]".
我对来自该interop 程序集的type [*] 的其他struct、int 和string arrays 也有同样的问题。
显然someType[*] 是一个数组,它的起始索引不是零。 (What does System.Double[*] mean) 并且有一种方法可以访问它的值。但是如何给它赋值呢?
顺便说一句:我之前在 Visual Studio 2012 Profession 中处理过这个项目,但没有出现这个问题。现在我使用 Visual Studio 2015 Prof.
【问题讨论】:
标签: c# arrays interop marshalling labview