NetworkInterface.NetworkInterfaceType Property

 

Gets the interface type.

Namespace:   System.Net.NetworkInformation
Assembly:  System (in System.dll)

public virtual NetworkInterfaceType NetworkInterfaceType { get; }

Property Value

Type: System.Net.NetworkInformation.NetworkInterfaceType

An NetworkInterfaceType value that specifies the network interface type.

The interface types are described in detail in the NetworkInterfaceType enumeration documentation.

This property only returns a subset of the possible values defined in the NetworkInterfaceType enumeration. The possible values include the following:

The following code example displays type information for all interfaces on the local computer.

 public static void DisplayTypeAndAddress()
{
    IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
    NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
    Console.WriteLine("Interface information for {0}.{1}     ",
            computerProperties.HostName, computerProperties.DomainName);
    foreach (NetworkInterface adapter in nics)
    {
        IPInterfaceProperties properties = adapter.GetIPProperties();
        Console.WriteLine(adapter.Description);
        Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
        Console.WriteLine("  Interface type .......................... : {0}", adapter.NetworkInterfaceType);
        Console.WriteLine("  Physical Address ........................ : {0}", 
                   adapter.GetPhysicalAddress().ToString());
        Console.WriteLine("  Is receive only.......................... : {0}", adapter.IsReceiveOnly);
        Console.WriteLine("  Multicast................................ : {0}", adapter.SupportsMulticast);
        Console.WriteLine();
      }
   }

.NET Framework
Available since 2.0
Return to top
Show: