Share via


ConnectionCost Class

Definition

Exposes cost and data plan constraint information for a network connection so apps can adapt data usage behavior.

public ref class ConnectionCost sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ConnectionCost final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ConnectionCost
Public NotInheritable Class ConnectionCost
Inheritance
Object Platform::Object IInspectable ConnectionCost
Attributes

Windows requirements

Requirements Description
Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

ConnectionCost instances come from
ConnectionProfile.GetConnectionCost. They describe cost policies,
roaming state, plan limits, and background restrictions so applications can adjust transfer strategies.

Key properties

Core cost indicators

Background restriction

Important

Always evaluate cost properties before large or background transfers. Respecting constraints preserves user data allowances and improves experience.

Adaptive behavior patterns

Condition Recommended strategy
Unrestricted Full-fidelity sync, media prefetch, normal background work
Fixed Regular operations; gate large optional downloads (offer user confirmation)
Variable Minimize non-essential transfers; compress & batch user-initiated large tasks
ApproachingDataLimit Warn before large downloads; lower streaming bitrate / quality
OverDataLimit Pause non-critical background sync; require explicit user action for large transfers
Roaming Suppress large automatic updates; prefer incremental / compressed payloads
BackgroundDataUsageRestricted Restrict background-only telemetry & sync; allow user foreground actions
Roaming + Variable/Fixed Strict throttling; surface lightweight usage indicator

Implementation notes

  • Evaluate individual flags; do not rely solely on NetworkCostType transitions.
  • Re-check cost just before initiating sizable transfers (state can change mid-session).
  • Prefer incremental chunking (smaller segments respect shifting policy constraints).

Properties

Name Description
ApproachingDataLimit

Gets a value that indicates if a connection is approaching the data usage allowance specified by the data plan.

BackgroundDataUsageRestricted

Gets a value that indicates whether background data usage has been restricted.

NetworkCostType

Gets a value that indicates the current network cost for a connection.

OverDataLimit

Gets a value that indicates if the connection has exceeded the data usage allowance specified by the data plan.

Roaming

Gets a value that indicates whether the connection is connected to a network outside of the home provider.

Applies to

See also