I'm using this code:
NetworkInformation.NetworkInterface[] interfaces = NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
the abo开发者_运维技巧ve code retrieving only the active network connections, I need of all. How I do this? Thanks in advance. :)
using System.Management;
ManagementObjectSearcher query = new ManagementObjectSearcher(
"SELECT * FROM Win32_NetworkAdapterConfiguration" );
ManagementObjectCollection queryCollection = query.Get();
foreach (ManagementObject mo in queryCollection)
{
Console.WriteLine(mo["Description"].ToString());
}
Edit:
to find all others ["Properties"] name, change the foreach like this:
foreach (ManagementObject mo in queryCollection)
{
foreach (PropertyData pd in mo.Properties)
{
Console.WriteLine(pd.Name);
}
}
精彩评论