日期:2014-05-18 浏览次数:20901 次
/// <summary> /// 获取网卡MacAddress /// </summary> /// <returns></returns> public static string getID_NetCardId() { string NCid = ""; ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); foreach (ManagementObject mo in moc) { if ((bool)mo["IPEnabled"] == true) NCid = mo["MacAddress"].ToString(); mo.Dispose(); } return NCid; }