Поделиться через


WPD Collection Interfaces (Part 3)

We'll cover the last collection type, IPortableDeviceValuesCollection, here. To refresh - Part 1 discussed IPortableDeviceKeyCollection and IPortableDeviceValues while Part 2 covered IPortableDevicePropVariantCollection.

IPortableDeviceValuesCollection

Going by the name, this collection contains elements of type IPortableDeviceValues. If you look really closely, you'll realize that this is just IPortableDevicePropVariantCollection with wrapper functions around it geared towards IPortableDeviceValues.

Currently, there are exactly two places that you would need to use this collection. One is the bulk property retrieval APIs and the other is the rendering information from the device. Both of these topics really deserve posts of their own, so I'll skip examples and try illustrating the concept.

If you remember from the IPortableDeviceValues example from Part 1, we retrieved properties for a single object and we got back a single IPortableDeviceValues interface. Now visualize that example as being extended to retrieve properties for two objects, so we'll get back an array of two IPortableDeviceValues interfaces. Keep extending it to N, and you'll get the picture :). Of course, instead of getting back a plain-old C-style array, you get back an IPortableDeviceValuesCollection interface (which is an array of IPortableDeviceValues interfaces).