以下工作正常:
public value struct Foo {
Platform::String^ Name;
Platform::String^ Type;
};
但是,当我尝试添加Platform::Array<double>^
时,我会收到一条错误消息。
public value struct Foo {
Platform::String^ Name;
Platform::String^ Type;
const Platform::Array<double>^ Value;
};
错误讯息:
signature of public member contains invalid type 'const Platform::Array<double,1> ^
我也试过这个const Platform::Array<Platform::String^>^ Values
。但我会有类似的错误信息:
signature of public member contains invalid type 'const Platform::Array<Platform::String ^,1> ^'
这是什么意思?我该如何解决这个问题?
修改:在这种情况下必须使用class
,因为value struct
只能包含基本数字类型,枚举类或Platform::String^
字段。
public ref class Foo sealed {
property Platform::String^ Name;
property Platform::String^ Type;
property Platform::Array<Platform::String^>^ Values;
};