zoukankan      html  css  js  c++  java
  • C#检测是否联网

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;

    namespace LocalApp.ConsoleApp.Core
    {
        
    public class Net
        
    {
            [DllImport(
    "wininet")]
            
    private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);

            
    /// <summary>
            
    /// 检测本机是否联网
            
    /// </summary>
            
    /// <returns></returns>

            public static bool IsConnectedInternet()
            
    {
                
    int i = 0;
                
    if (InternetGetConnectedState(out i, 0))
                
    {
                    
    //已联网
                    return true;
                }

                
    else
                
    {
                    
    //未联网
                    return false;
                }


            }


        }

    }

  • 相关阅读:
    Mybatis里面的一对多,一对一查询
    Mybatis简单数据库查询
    tree的使用
    datagrid里面的实现分页功能
    web去掉浏览器自带默认样式
    C#邮件发送
    如何选择正确的标签?
    Table表格的一些操作
    SQL常用分页
    easyui-window
  • 原文地址:https://www.cnblogs.com/yiki/p/1378823.html
Copyright © 2011-2022 走看看