Detecting network connection status with the System.Net.NetworkInformation namespace

Got a smart client application that needs to detect the network connection state? Using the .NET Framework 2.0?

Then let me introduce you to your new favorite namespace: System.Net.NetworkInformation.

System.Net.NetworkInformation namespace provides access to network traffic data, network address information, and notification of address changes for the local computer. The namespace also contains classes that implement the Ping utility. You can use Ping and related classes to check whether a computer is reachable across the network.

By the way, don't forget the cool ability to just append a namespace to the msdn2 url like so:

https://msdn2.microsoft.com/system.net.networkinformation

Getting back to System.Net.NetworkInformation - have a look at my buddy John's awesome blog post on this namespace.