Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NetworkInterface::NetworkInterfaceType Property

 

Gets the interface type.

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

public:
property NetworkInterfaceType NetworkInterfaceType {
	virtual 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.

void DisplayTypeAndAddress()
{
   IPGlobalProperties ^ computerProperties = IPGlobalProperties::GetIPGlobalProperties();
   array<NetworkInterface^>^nics = NetworkInterface::GetAllNetworkInterfaces();
   Console::WriteLine( "Interface information for {0}.{1}     ", computerProperties->HostName, computerProperties->DomainName );
   System::Collections::IEnumerator^ myEnum27 = nics->GetEnumerator();
   while ( myEnum27->MoveNext() )
   {
      NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum27->Current);
      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() );
      Console::WriteLine( "  Is receive only.......................... : {0}", 
         adapter->IsReceiveOnly );
      Console::WriteLine( "  Multicast................................ : {0}", 
         adapter->SupportsMulticast );
   }
}

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft