By using the NetworkInformation namespace
you can get all of the available network interfaces on the current machine.
This is very useful for applications that are network aware
or that require to configure the network adapters.
1: //Iterate to all available network interfaces
2: foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
4: // Filter to load only configurable interfaces
5: if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet |
6: netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
8: //Use the ff as strings, add to a collection or a list
The above snippet came from a little project that I wrote for me and my Amy that configures our wireless and cabled adapters. Because we both have laptops that connects to both of our office wireless, LAN on their conference (no wireless signal there), wireless in the condo, wireless at Bataan (ssshhh its free, but we need to configure your DNS to SMART BRO :P, it seems that their neighbor has DHCP but did not configured / or has hidden the DNS)