共用方式為


Platform.GetDevices 方法

更新:2007 年 11 月

取得與此平台關聯的所有裝置集合。

命名空間:  Microsoft.SmartDevice.Connectivity
組件:  Microsoft.SmartDevice.Connectivity (在 Microsoft.SmartDevice.Connectivity.dll 中)

語法

Public Function GetDevices As Collection(Of Device)

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>

傳回值

型別:System.Collections.ObjectModel.Collection<Device>

傳回與平台關聯的裝置集合。

範例

' Get datastore object
Dim dsmgr As New DatastoreManager(1033)

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

' For each platform, output name and ID
Dim platform As Platform
For Each platform In platforms
    Console.WriteLine("Platform Name: " & _
                      platform.Name & "    ID: " & platform.Id.ToString())
    Console.WriteLine("    OSVersion: " & platform.GetProperty("OSVersion"))
    Console.WriteLine("    DefaultPlatform: " & _
                      platform.GetProperty("DefaultPlatform"))
    Console.WriteLine("    DefaultDevice: " & platform.GetProperty("DefaultDevice"))
    Console.WriteLine("    ShortName: " & platform.GetProperty("ShortName"))
    Console.WriteLine("    DefaultFormFactor: " & _
                      platform.GetProperty("DefaultFormFactor"))
Next platform
// Get datastore object
DatastoreManager dsmgr = new DatastoreManager(1033);

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

// For each platform, output name, ID, and platform properties.
foreach (Platform platform in platforms)
{
    Console.WriteLine("Platform Name: " + platform.Name + "    ID: " + platform.Id);
    Console.WriteLine("    OSVersion: " + platform.GetProperty("OSVersion"));
    Console.WriteLine("    DefaultPlatform: " + 
        platform.GetProperty("DefaultPlatform"));
    Console.WriteLine("    DefaultDevice: " + platform.GetProperty("DefaultDevice"));
    Console.WriteLine("    ShortName: " + platform.GetProperty("ShortName"));
    Console.WriteLine("    DefaultFormFactor: " + 
        platform.GetProperty("DefaultFormFactor"));
}

使用權限

請參閱

參考

Platform 類別

Platform 成員

Microsoft.SmartDevice.Connectivity 命名空間