NetworkInterface.Speed 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得網路介面的速度。
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
屬性值
Int64 值,指定速度 (每秒位元數)。
範例
下列程式代碼範例示範如何在本機計算機上顯示介面的速度。
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
備註
這個屬性傳回的值是由網路介面所報告。 它不會以動態方式計算。