📅  最后修改于: 2022-03-11 14:49:20.179000             🧑  作者: Mango
public static bool CheckForInternetConnection()
{
try
{
using (var client = new WebClient())
using (client.OpenRead("http://google.com/generate_204"))
return true;
}
catch
{
return false;
}
}