Using IIterable

The WinRT DataPackage::SetStorageItems API function accepts a parameter of type IIterable<IStorageItem^>^ . I have one StorageItem^ , not a collection.

I'm a little confused about how to create an IIterable collection from it, since I cannot find the WinRT collection class that implements the interface. I understand that I can create my own class using IIterable as a base, but I assume that there are existing classes that I just don't see.

What am I missing here?

I think this is obvious, but: C ++, VS11, Win8, Metro.

+6
source share
1 answer

I think you want the Vector class from a C ++ / CX-specific namespace Platform::Collections :

 DataPackage^ package = …; IStorageItem^ item = …; Vector<IStorageItem^>^ items = ref new Vector<IStorageItem^>(); items->Append(item); package->SetStorageItems(items); 
+7
source

Source: https://habr.com/ru/post/911503/


All Articles