NetworkInformation Class

Definition

Provides access to network connection information for the local machine.

C#
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public static class NetworkInformation
Inheritance
Object NetworkInformation
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

For examples of how NetworkInformation class methods are implemented, see Quickstart: Retrieving network connection information.

Methods

FindConnectionProfilesAsync(ConnectionProfileFilter)

Returns an array of ConnectionProfile objects that match the filtering criteria defined by ConnectionProfileFilter.

GetConnectionProfiles()

Gets a list of profiles for connections, active or otherwise, on the local machine.

GetHostNames()

Gets a list of host names associated with the local machine.

GetInternetConnectionProfile()

Retrieves the connection profile associated with the preferred interface currently used by the local machine. The preferred interface is the one most likely to send or receive internet traffic. This means that the returned profile might or might not have internet access.

GetLanIdentifiers()

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and location.

Gets an array of LanIdentifier objects that contain locality information for each NetworkAdapter object that currently connected to a network.

GetProxyConfigurationAsync(Uri)

Gets proxy configuration for a connection using the specified URI.

Note

This class method is not supported on Windows Phone.

GetSortedEndpointPairs(IIterable<EndpointPair>, HostNameSortOptions)

Gets a sorted list of EndpointPair objects.

Events

NetworkStatusChanged

Occurs when the network status changes for a connection.

Applies to

Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

See also