Udostępnij za pośrednictwem


NetworkInformation Class

Definition

Provides access to network connection information for the local machine.

public ref class NetworkInformation abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class NetworkInformation final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public static class NetworkInformation
Public Class NetworkInformation
Inheritance
Object Platform::Object IInspectable 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

See also