PnpObjectCollection PnpObjectCollection PnpObjectCollection PnpObjectCollection PnpObjectCollection Class

Definition

Represents an iterable collection of Pnp device objects.

public : sealed class PnpObjectCollection
struct winrt::Windows::Devices::Enumeration::Pnp::PnpObjectCollection
public sealed class PnpObjectCollection
Public NotInheritable Class PnpObjectCollection
// This class does not provide a public constructor.
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Collection member lists

For JavaScript, PnpObjectCollection has the members shown in the member lists. In addition, PnpObjectCollection supports a length property, members of Array.prototype, and using an index to access items.

Enumerating the collection in C# or Microsoft Visual Basic

PnpObjectCollection is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<PnpObject> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable with a PnpObject constraint.

Enumerating the collection in C++/WinRT

...
using namespace Windows::Devices::Enumeration::Pnp;
...
void EnumerateCollection(PnpObjectCollection const& collection)
{
    for (PnpObject const& object : collection)
    {
        // ...
    }
}

Also see Collections with C++/WinRT.

Properties

Size Size Size Size Size

Returns the number of items in the collection.

Methods

First() First() First() First() First()

Returns the iterator for iteration over the items in the collection.

GetAt(UInt32) GetAt(UInt32) GetAt(UInt32) GetAt(UInt32) GetAt(UInt32)

Returns the PnpObject located at the specified index.

GetMany(UInt32, PnpObject[]) GetMany(UInt32, PnpObject[]) GetMany(UInt32, PnpObject[]) GetMany(UInt32, PnpObject[]) GetMany(UInt32, PnpObject[])

Retrieves multiple elements in a single pass through the iterator.

IndexOf(PnpObject, UInt32) IndexOf(PnpObject, UInt32) IndexOf(PnpObject, UInt32) IndexOf(PnpObject, UInt32) IndexOf(PnpObject, UInt32)

Retrieves the index of the specified item.