首页 > 开发 > 综合 > 正文

获取网卡地址 MAC

2024-07-21 02:15:46
字体:
来源:转载
供稿:网友
using system.management;


获取网卡地址 mac



public string getmacaddress()
{
managementclass adapters = new managementclass("win32_networkadapterconfiguration");
string macaddress = "unknown";
foreach (managementobject adapter in adapters.getinstances())
{
if((bool)adapter["ipenabled"] == true)
{
macaddress = adapter.properties["macaddress"].value.tostring();
break;
}
}
return macaddress;
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表