Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using IIterable

The WinRT API function DataPackage::SetStorageItems takes a parameter of type IIterable<IStorageItem^>^. What I have is a single StorageItem^, not a collection.

I'm a bit confused as to how to create an IIterable collection from this, since I can't find a WinRT collection class that implements the interface. I realize that I can create my own class using IIterable as a base, but my guess is that there are existing classes that I'm just not seeing.

What am I missing here?

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

like image 949
chrisd Avatar asked Mar 23 '12 14:03

chrisd


1 Answers

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

DataPackage^ package = …;
IStorageItem^ item = …;
Vector<IStorageItem^>^ items = ref new Vector<IStorageItem^>();
items->Append(item);
package->SetStorageItems(items);
like image 84
svick Avatar answered Oct 02 '22 03:10

svick