Compartilhar via


NetworkInterface.Speed Propriedade

Definição

Obtém a velocidade do adaptador de rede.

public:
 virtual property long Speed { long get(); };
public:
 abstract property long Speed { long get(); };
public virtual long Speed { get; }
public abstract long Speed { get; }
member this.Speed : int64
Public Overridable ReadOnly Property Speed As Long
Public MustOverride ReadOnly Property Speed As Long

Valor da propriedade

Um valor Int64 que especifica a velocidade em bits por segundo.

Exemplos

O exemplo de código a seguir demonstra a exibição da velocidade das interfaces no computador local.

void ShowInterfaceSpeedAndQueue()
{
   array<NetworkInterface^>^adapters = NetworkInterface::GetAllNetworkInterfaces();
   System::Collections::IEnumerator^ myEnum9 = adapters->GetEnumerator();
   while ( myEnum9->MoveNext() )
   {
      NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum9->Current);
      IPInterfaceProperties ^ properties = adapter->GetIPProperties();
      IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics();
      Console::WriteLine( adapter->Description );
      Console::WriteLine( "     Speed .................................: {0}", 
         adapter->Speed );
      Console::WriteLine( "     Output queue length....................: {0}", 
         stats->OutputQueueLength );
   }
}
public static void ShowInterfaceSpeedAndQueue()
{
    NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
    foreach (NetworkInterface adapter in adapters)
    {
        IPInterfaceProperties properties = adapter.GetIPProperties();
        IPv4InterfaceStatistics stats = adapter.GetIPv4Statistics();
         Console.WriteLine(adapter.Description);
        Console.WriteLine("     Speed .................................: {0}",
            adapter.Speed);
        Console.WriteLine("     Output queue length....................: {0}",
            stats.OutputQueueLength);
    }
}
Public Shared Sub ShowInterfaceSpeedAndQueue() 
    Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
    Dim adapter As NetworkInterface
    For Each adapter In  adapters
        Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
        Dim stats As IPv4InterfaceStatistics = adapter.GetIPv4Statistics()
        Console.WriteLine(adapter.Description)
        Console.WriteLine("     Speed .................................: {0}", adapter.Speed)
        Console.WriteLine("     Output queue length....................: {0}", stats.OutputQueueLength)
    Next adapter

End Sub

Comentários

O valor retornado por essa propriedade é relatado pelo adaptador de rede. Ele não é calculado dinamicamente.

Aplica-se a