Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 948 Bytes

package_isoptional.md

File metadata and controls

36 lines (26 loc) · 948 Bytes
-api-id -api-type
P:Windows.ApplicationModel.Package.IsOptional
winrt property

Windows.ApplicationModel.Package.IsOptional

-description

Indicates whether the package is optional.

-property-value

Returns true if the package is optional; false otherwise.

-remarks

Optional packages are dependent on another package that must be installed first. For example a map application may have optional geographic area packages.

-examples

// Get the main app package
Package currentPackage = Package.Current;

// Get a list of dependencies for the main package. This includes all resource packages, framework packages, and optional packages.
IReadOnlyList<Package> dependencies = currentPackage.Dependencies;

foreach (Package package in dependencies.Where(_ => _.IsOptional))
{
    // Iterate through a list of the optional packages
}

-see-also