Windows store apps 如何从IVector接口实现GetMany方法

Windows store apps 如何从IVector接口实现GetMany方法,windows-store-apps,c++-cx,Windows Store Apps,C++ Cx,我已尝试创建ICollectionView的自定义实现,但我的应用程序尚未通过认证。原因是WACK工具声明GetMany方法的签名与windows.winmd中GetMany的签名不匹配 下面是windows.winmd对GetMany的看法: unsigned int GetMany(unsigned int startIndex, [Windows::Foundation::Metadata::LengthIsAttribute] Platform::Array<T>^ item

我已尝试创建ICollectionView的自定义实现,但我的应用程序尚未通过认证。原因是WACK工具声明GetMany方法的签名与windows.winmd中GetMany的签名不匹配

下面是windows.winmd对GetMany的看法:

unsigned int GetMany(unsigned int startIndex, [Windows::Foundation::Metadata::LengthIsAttribute] Platform::Array<T>^ items)
unsigned int GetMany(unsigned int startIndex[Windows::Foundation::Metadata::LengthIsAttribute]平台::数组^items)
然而,根据编译器的提示,我已经这样定义了GetMany方法:

virtual unsigned int GetMany(unsigned int index, Platform::WriteOnlyArray<Platform::Object^>^ items);
virtual unsigned int GetMany(unsigned int index, Platform::Array<Platform::Object^>^* items);
virtualunsignedintgetmany(unsignedintindex,Platform::WriteOnlyArray^items);
它的编译和工作都很好,但怪人对此表示不满。我还发现数组作为输出参数可以通过以下方式实现:

virtual unsigned int GetMany(unsigned int index, Platform::WriteOnlyArray<Platform::Object^>^ items);
virtual unsigned int GetMany(unsigned int index, Platform::Array<Platform::Object^>^* items);
virtualunsigned int GetMany(unsigned int索引,Platform::Array^*项);
然而,在这种情况下,编译器说我的类是抽象的,它错过了GetMany方法的实现。我甚至尝试实现这两种方法,但这使编译器崩溃


我可以使用变通方法并以不同的方式实现功能(不使用ICollectionView),但是,从设计角度来看,此解决方案最适合我。

在您的安装中查看collection.h(它定义了Platform::VectorView的实现)可能会有所启发。它将GetMany函数定义为:

virtual unsigned int GetMany(unsigned int startIndex, WriteOnlyArray<T>^ dest)
virtualunsigned int GetMany(unsigned int startIndex,WriteOnlyArray^dest)
因此,您希望使用
WriteOnlyArray
是正确的。您的集合是否在类型
对象^code>上模板化


关于不同WinRT数组模式及其使用的MSDN主题隐藏得很好,但信息丰富:

这一定是一个奇怪的错误,我很确定IVector::GetMany()使用的so WriteOnly数组是正确的。谷歌的其他代码也使用它。用正确的WAKE错误消息更新你的问题,考虑在连接器上提交bug报告。微软公司在波兰有消息,所以这是没有用的。自从微软开始翻译其开发工具以来,我们这些非英语母语人士在谷歌上搜索问题解决方案时遇到了问题。我将尝试使用connect.microsoft.com