Hi i'm using this method for get the mac address
public string GetMACAddress()
{
System.Management.ManagementClass mc = default(System.Management.ManagementClass);
ManagementObject mo = default(ManagementObject);
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (var mo in moc)
{
if (mo.Item("IPEnabled") == true)
{
return mo.Item("MacAddress").ToString();
}else
return null;
}
}
but i receive this error
Compiler Error Message: CS0234: The type or namespace name 'ManagementClass' does not exist in the namespace 'System.Management' (are you missing an assembly reference?)
What i have to do for fix it?
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…