Mega Code Archive

 
Categories / C# by API / System Net Networknformation
 

NetworkInterface OperationalStatus

using System; using System.Net.NetworkInformation; class MainClass {     static void Main()     {         if (!NetworkInterface.GetIsNetworkAvailable())            return;         NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();         foreach (NetworkInterface ni in interfaces)         {                          Console.WriteLine("Interface Name: {0}", ni.Name);             Console.WriteLine("    Description: {0}", ni.Description);             Console.WriteLine("    ID: {0}", ni.Id);             Console.WriteLine("    Type: {0}", ni.NetworkInterfaceType);             Console.WriteLine("    Speed: {0}", ni.Speed);             Console.WriteLine("    Status: {0}", ni.OperationalStatus);         }     } }