共用方式為


Platform 類別

更新:2007 年 11 月

表示資料存放區中註冊的 Windows CE 架構平台 (例如 Windows Mobile 5.0 Pocket PC)。

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

語法

Public Class Platform

Dim instance As Platform
public class Platform
public ref class Platform
public class Platform

備註

這個類別沒有任何建構函式 (Constructor)。若要取得執行個體 (Instance),請使用 DatastoreManager.GetPlatformDatastoreManager.GetPlatforms

範例

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



Class Example

    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()

        ' 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

        Console.ReadLine()

    End Sub 'Main
End Class 'Example


using System;
using System.Collections.ObjectModel;
using Microsoft.SmartDevice.Connectivity;

class Example
{
    static void Main(string[] args)
    {
        // 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"));
        }

        Console.ReadLine();
    }
}

繼承階層架構

System.Object
  Microsoft.SmartDevice.Connectivity.Platform

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

Platform 成員

Microsoft.SmartDevice.Connectivity 命名空間