这是我用于查找MAC地址的代码,但是当我在任何设备上运行此代码时,它也会显示相同的结果?
public string GetMACAddress1()
{
try
{
NetworkInterface[] anics=NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in anics)
{
if (amacaddress == String.Empty)
{
IPInterfaceProperties properties =adapter.GetIPProperties();
amacaddress = adapter.GetPhysicalAddress().ToString();
}
}
return "MAC Address is :- " + amacaddress;
}
catch
{
return "error";
}
}
我怎么能得到这个??