G
Guest
Hi,
This is the code I'm using to get MAC address..
-------------------------------------------------------------------------------------------
ManagementClass mc = new ManagementClass
("WIN32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach(ManagementObject mo in moc)
{
if((bool)mo["IPEnabled"] == true )
{
Console.WriteLine("MAC Address \t{0}", mo["MacAddress"].ToString());
mo.Dispose();
}
}
-----------------------------------------------------------------------------------------------
Execution of this code is taking about 4-5 seconds!!!!. Is this normal or
am I doing anything wrong.. is there any quicker way of finding MAC address
of
of a PC using C#.
Kindly let me know
Cheers,
Naveen.
This is the code I'm using to get MAC address..
-------------------------------------------------------------------------------------------
ManagementClass mc = new ManagementClass
("WIN32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach(ManagementObject mo in moc)
{
if((bool)mo["IPEnabled"] == true )
{
Console.WriteLine("MAC Address \t{0}", mo["MacAddress"].ToString());
mo.Dispose();
}
}
-----------------------------------------------------------------------------------------------
Execution of this code is taking about 4-5 seconds!!!!. Is this normal or
am I doing anything wrong.. is there any quicker way of finding MAC address
of
of a PC using C#.
Kindly let me know
Cheers,
Naveen.