共用方式為


PackageVersion 結構

定義

表示套件版本資訊。

public value class PackageVersion
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
struct PackageVersion
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public struct PackageVersion
var packageVersion = {
major : /* Your value */,
minor : /* Your value */,
build : /* Your value */,
revision : /* Your value */
}
Public Structure PackageVersion
繼承
PackageVersion
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

使用 Package.Current 屬性取得目前應用程式的套件。 使用 Package.Id 屬性來取得套件識別碼,然後您可以從中取得版本。

var package = Windows.ApplicationModel.Package.current;
var packageId = package.id;
var version = packageId.version;
using Windows.ApplicationModel;

Package package = Package.Current;
PackageId packageId = package.Id;
PackageVersion version = packageId.Version;
Dim package As Windows.ApplicationModel.Package = Windows.ApplicationModel.Package.Current
Dim packageId As Windows.ApplicationModel.PackageId = package.Id
Dim version As Windows.ApplicationModel.PackageVersion = packageId.Version
Windows::ApplicationModel::Package package{ Windows::ApplicationModel::Package::Current() };
Windows::ApplicationModel::PackageId packageId{ package.Id() };
Windows::ApplicationModel::PackageVersion version{ packageId.Version() };
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::ApplicationModel::PackageId^ packageId = package->Id;
Windows::ApplicationModel::PackageVersion version = packageId->Version;

欄位

Build

套件的組建版本號碼。

Major

套件的主要版本號碼。

Minor

套件的次要版本號碼。

Revision

套件的修訂版本號碼。

適用於

另請參閱