Jer*_*xon 1 windows-phone-7 windows-phone-7.1
DeviceNetworkInformation.IsNetworkAvailable
// Summary:
// Gets a value that indicates whether the network is available.
//
// Returns:
// true if there is at least one network interface available; otherwise, false.
public static bool IsNetworkAvailable { get; }
Run Code Online (Sandbox Code Playgroud)
NetworkInterface.GetIsNetworkAvailable()
// Summary:
// Indicates whether any network connection is available.
//
// Returns:
// true if a network connection is available; otherwise, false.
[SecuritySafeCritical]
public static bool GetIsNetworkAvailable();
Run Code Online (Sandbox Code Playgroud)
这些相同吗?
微软希望你使用 DeviceNetworkInformation.IsNetworkAvailable
NetworkInterface
是在System.Net
其中如DeviceNetworkInformation
在Microsoft.Phone.Net.NetworkInformation
.
该DeviceNetworkInformation.IsNetworkAvailable
会映射到NetworkInterface.GetIsNetworkAvailable()
内部,但你应该总是使用DeviceNetworkInformation.IsNetworkAvailable
,因为它为手机制造(和有一个更简洁的API).
正如Matthieu所指出的那样,DeviceNetworkInformation.IsNetworkAvailable
在7.1(Mango)中显然是新的.
归档时间: |
|
查看次数: |
1388 次 |
最近记录: |