DeviceInformationCollection DeviceInformationCollection DeviceInformationCollection DeviceInformationCollection DeviceInformationCollection Class


Represents a collection of DeviceInformation objects.

public : sealed class DeviceInformationCollection : IIterable<DeviceInformation>, IVectorView<DeviceInformation>
struct winrt::Windows::Devices::Enumeration::DeviceInformationCollection : IIterable<DeviceInformation>, IVectorView<DeviceInformation>
public sealed class DeviceInformationCollection : IEnumerable<DeviceInformation>, IReadOnlyList<DeviceInformation>
Public NotInheritable Class DeviceInformationCollection Implements IEnumerable<DeviceInformation>, IReadOnlyList<DeviceInformation>
// This class does not provide a public constructor.

Windows 10 requirements

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


var DeviceInformation = Enumeration.DeviceInformation;

// Handles successful completion of the findAllAsync method.
function successCallback(deviceInformationCollection) {
    var numDevices = deviceInformationCollection.length;
    document.getElementById("statusMessage").innerHTML = 
        numDevices + " device interface(s) found";
    if (numDevices) {
        for (var i = 0; i < numDevices; i++) {
    } else {
        document.getElementById("statusMessage").innerHTML = "No devices found";

// Handles an error completion of the findAllAsync method.
function errorCallback(e) {
    document.getElementById("statusMessage").innerHTML = 
        "Failed to find devices, error: " + e.message;


Successful completion of FindAllAsync results in a DeviceInformationCollection containing DeviceInformation objects.

Collection member lists

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

Enumerating the collection in C# or Microsoft Visual Basic

DeviceInformationCollection 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<DeviceInformation> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable with a DeviceInformation constraint.


Item[Int32] Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets the element at the specified index in the read-only list.

Size Size Size Size Size

The number of DeviceInformation objects in the collection.


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

Gets an object that can iterate through the enumerated DeviceInformation objects, starting with the first.

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

Gets the DeviceInformation object at the specified index.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

GetMany(UInt32, DeviceInformation[]) GetMany(UInt32, DeviceInformation[]) GetMany(UInt32, DeviceInformation[]) GetMany(UInt32, DeviceInformation[]) GetMany(UInt32, DeviceInformation[])

Gets a range of DeviceInformation objects.

IndexOf(DeviceInformation, UInt32) IndexOf(DeviceInformation, UInt32) IndexOf(DeviceInformation, UInt32) IndexOf(DeviceInformation, UInt32) IndexOf(DeviceInformation, UInt32)

Returns the index of the specified DeviceInformation object in the collection.