NetworkInterface.Description NetworkInterface.Description NetworkInterface.Description NetworkInterface.Description Property

Definizione

Ottiene la descrizione dell'interfaccia.Gets the description of the interface.

public:
 virtual property System::String ^ Description { System::String ^ get(); };
public virtual string Description { get; }
member this.Description : string
Public Overridable ReadOnly Property Description As String

Valore della proprietà

Classe String che descrive quest'interfaccia.A String that describes this interface.

Esempi

Esempio di codice seguente visualizza un riepilogo per tutte le interfacce nel computer locale.The following code example displays a summary for all interfaces on the local computer.

void ShowInterfaceSummary()
{
   array<NetworkInterface^>^interfaces = NetworkInterface::GetAllNetworkInterfaces();
   System::Collections::IEnumerator^ myEnum5 = interfaces->GetEnumerator();
   while ( myEnum5->MoveNext() )
   {
      NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum5->Current);
      Console::WriteLine( "Name: {0}", adapter->Name );
      Console::WriteLine( adapter->Description );
      Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) );
      Console::WriteLine( "  Interface type .......................... : {0}",
         adapter->NetworkInterfaceType );
      Console::WriteLine( "  Operational status ...................... : {0}", adapter->OperationalStatus );
      String^ versions = "";

      // Create a display string for the supported IP versions.
      if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) )
      {
         versions = "IPv4";
      }

      if ( adapter->Supports( NetworkInterfaceComponent::IPv6 ) )
      {
         if ( versions->Length > 0 )
         {
            versions = String::Concat( versions, " " );
         }

         versions = String::Concat( versions, "IPv6" );
      }

      Console::WriteLine( "  IP version .............................. : {0}", versions );
      Console::WriteLine();
   }

   Console::WriteLine();
}
public static void ShowInterfaceSummary()
{
    
    NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
    foreach (NetworkInterface adapter in interfaces)
    {                
        Console.WriteLine ("Name: {0}", adapter.Name);
        Console.WriteLine(adapter.Description);
        Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
        Console.WriteLine("  Interface type .......................... : {0}", adapter.NetworkInterfaceType);
        Console.WriteLine("  Operational status ...................... : {0}", 
            adapter.OperationalStatus);
        string versions ="";

        // Create a display string for the supported IP versions.
        if (adapter.Supports(NetworkInterfaceComponent.IPv4))
        {
             versions = "IPv4";
         }
        if (adapter.Supports(NetworkInterfaceComponent.IPv6))
        {
            if (versions.Length > 0)
            {
                versions += " ";
             }
            versions += "IPv6";
        }
        Console.WriteLine("  IP version .............................. : {0}", versions);
        Console.WriteLine();
    }
    Console.WriteLine();
}

Commenti

La descrizione è testo leggibile che descrive l'interfaccia di rete.The description is human-readable text that describes the network interface. Le informazioni incluse nella descrizione dipendono dalle funzionalità del sistema operativo.The information included in the description depends on the capabilities of the operating system. In Windows, la descrive in genere il fornitore dell'interfaccia, tipo (ad esempio, Ethernet), marchio e modello.On Windows, it typically describes the interface vendor, type (for example, Ethernet), brand, and model. In altre piattaforme, potrebbe essere più breve il nome dell'interfaccia, ad esempio eth0.On other platforms, it may be as brief as the name of the interface, such as eth0.

Si applica a