由于电脑可能会有多个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;
}
所以取为列表 其中第一个即为最近使用的地址
本文介绍了一种使用C#编程语言来获取计算机上所有网络接口的MAC地址的方法,并将其存储为列表形式,便于进一步处理和应用。
1033

被折叠的 条评论
为什么被折叠?



