using System.Net.NetworkInformation; public string GetMacAddress() { string physicalAddress = ""; NetworkInterface[] nice = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adaper in nice) { if (adaper.Description == "en0") { physicalAddress = adaper.GetPhysicalAddress().ToString(); break; } else { physicalAddress = adaper.GetPhysicalAddress().ToString(); if (physicalAddress != "") { break; }; } } return physicalAddress; }
此博客出自TaoHu,转载请注明原文地址 |
博客地址:http://www.cnblogs.com/htwzl/ |
-- Unity3D 学习交流 --