草庐IT

GetIsNetworkAvailable

全部标签

c# - 为什么 GetIsNetworkAvailable() 总是返回 true?

我有这个方法:publicstaticvoidtestConnection(){if(System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()){System.Windows.MessageBox.Show("Thiscomputerisconnectedtotheinternet");}else{System.Windows.MessageBox.Show("Thiscomputerisnotconnectedtotheinternet");}}我想它会告诉我连接是否可用,但它总是返回true(并打印