Aracılığıyla paylaş


Platform.GetDevices Method

Gets the collection of all devices associated with this platform.

Namespace:  Microsoft.SmartDevice.Connectivity
Assembly:  Microsoft.SmartDevice.Connectivity (in Microsoft.SmartDevice.Connectivity.dll)

Syntax

'Declaration
Public Function GetDevices As Collection(Of Device)
'Usage
Dim instance As Platform 
Dim returnValue As Collection(Of Device)

returnValue = instance.GetDevices()
public Collection<Device> GetDevices()
public:
Collection<Device^>^ GetDevices()
public function GetDevices() : Collection<Device>

Return Value

Type: System.Collections.ObjectModel.Collection<Device>
Returns a collection of devices associated with the platform.

Examples

Imports System
Imports System.Collections.ObjectModel
Imports Microsoft.SmartDevice.Connectivity

Class [source]

    Shared Sub Main(ByVal args() As String)
        ' Get datastore object 
        Dim dsmgr As New DatastoreManager(1033)

        ' Get the platforms in the Datastore 
        Dim platforms As Collection(Of Platform) = dsmgr.GetPlatforms()
        Dim devices As Collection(Of Device)

        ' For each platform, output name and ID 
        Dim platform As Platform
        For Each platform In platforms
            Console.WriteLine("Platform: " & platform.Name)
            devices = platform.GetDevices()
            Dim device As Device
            For Each device In devices
                Console.WriteLine("    Device: " & device.Name)
            Next device
        Next platform
        Console.ReadLine()
    End Sub 'Main
End Class '[source]
using System;
using System.Collections.ObjectModel;
using Microsoft.SmartDevice.Connectivity;

class source
{
    static void Main(string[] args)
    {
        // Get datastore object
        DatastoreManager dsmgr = new DatastoreManager(1033);

        // Get the platforms in the Datastore
        Collection<Platform> platforms = dsmgr.GetPlatforms();
        Collection<Device> devices;

        // For each platform, output name, ID, and platform properties. 
        foreach (Platform platform in platforms)
        {
            Console.WriteLine("Platform: " + platform.Name);
            devices = platform.GetDevices();
            foreach (Device device in devices)
            {
                Console.WriteLine("    Device: " + device.Name);
            }
        }
        Console.ReadLine();
    }
}

.NET Framework Security

See Also

Reference

Platform Class

Platform Members

Microsoft.SmartDevice.Connectivity Namespace