网络
using System.Runtime.InteropServices;
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
private static bool IsConnected()
{
int I = 0;
bool state = InternetGetConnectedState(out I, 0);
return state;
}
static void Main(string[] args)
{
Console.WriteLine(IsConnected().ToString());
}