6

WinRT API 函数DataPackage::SetStorageItems采用类型为 的参数IIterable<IStorageItem^>^。我拥有的是一个单一的StorageItem^,而不是一个集合。

我对如何从中创建一个IIterable集合有点困惑,因为我找不到实现该接口的 WinRT 集合类。我意识到我可以使用IIterable作为基础创建自己的类,但我的猜测是存在一些我没有看到的现有类。

我在这里想念什么?

我想这很明显,但是:C++、VS11、Win8、Metro。

4

1 回答 1

7

我认为您想要C++/CX 特定命名空间中的VectorPlatform::Collections

DataPackage^ package = …;
IStorageItem^ item = …;
Vector<IStorageItem^>^ items = ref new Vector<IStorageItem^>();
items->Append(item);
package->SetStorageItems(items);
于 2012-03-23T15:30:48.507 回答