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 以位元每秒表示速度的數值。
範例
以下程式碼範例示範如何在本地電腦上顯示介面速度。
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
備註
此屬性回傳的值會由網路介面回報。 它不是動態計算的。