由于电脑可能会有多个mac
using System.Net.NetworkInformation;
public static List<string> GetMacs()
{List<string> macs =new List<string>();
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface ni in interfaces)
{
macs.Add(ni.GetPhysicalAddress().ToString());
}
return macs;
}
所以取为列表 其中第一个即为最近使用的地址