C# 获取电脑Mac地址

  private string getMAC()
        {
            try
            {
                NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
                foreach (NetworkInterface ni in interfaces)
                {
                    return BitConverter.ToString(ni.GetPhysicalAddress().GetAddressBytes());
                }
            }
            catch (Exception)
            {
            }
            return "00-00-00-00-00-00";
        }

 

posted @ 2018-11-23 23:41  凉面好好吃  阅读(237)  评论(0编辑  收藏  举报