阅读背景:

c#判断是否有网络

来源:互联网 
//调用操作系统API  
[System.Runtime.InteropServices.DllImport("wininet")]
private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
      

/// <summary>
        /// 判断是否链接到外网
        /// </summary>
        public static bool IsNetWorkConnect()
        {
            int i = 0;
            return InternetGetConnectedState(out i, 0) ? true : false;
        }
//调用操作系统API  
[System.Runtime.InteropServic



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: