Using IIterable
Asked Answered
C

1

6

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.

Chkalov answered 23/3, 2012 at 14:47 Comment(0)
F
7

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);
Fundament answered 23/3, 2012 at 15:30 Comment(1)
That's it. I knew there had to be a compatible class somewhere--MS docs on this not quite up to snuff yet. Thanks!Chkalov

© 2022 - 2024 — McMap. All rights reserved.