NetworkInterface.NetworkInterfaceType プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
インターフェイスの種類を取得します。
public:
virtual property System::Net::NetworkInformation::NetworkInterfaceType NetworkInterfaceType { System::Net::NetworkInformation::NetworkInterfaceType get(); };
public:
abstract property System::Net::NetworkInformation::NetworkInterfaceType NetworkInterfaceType { System::Net::NetworkInformation::NetworkInterfaceType get(); };
public virtual System.Net.NetworkInformation.NetworkInterfaceType NetworkInterfaceType { get; }
public abstract System.Net.NetworkInformation.NetworkInterfaceType NetworkInterfaceType { get; }
member this.NetworkInterfaceType : System.Net.NetworkInformation.NetworkInterfaceType
Public Overridable ReadOnly Property NetworkInterfaceType As NetworkInterfaceType
Public MustOverride ReadOnly Property NetworkInterfaceType As NetworkInterfaceType
プロパティ値
ネットワーク インターフェイスの種類を示す NetworkInterfaceType。
例
次の例では、ローカル コンピューター上のすべてのインターフェイスの型情報を表示します。
public static void DisplayTypeAndAddress()
{
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
Console.WriteLine("Interface information for {0}.{1} ",
computerProperties.HostName, computerProperties.DomainName);
foreach (NetworkInterface adapter in nics)
{
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().ToString());
Console.WriteLine(" Is receive only.......................... : {0}", adapter.IsReceiveOnly);
Console.WriteLine(" Multicast................................ : {0}", adapter.SupportsMulticast);
Console.WriteLine();
}
}
Public Shared Sub DisplayTypeAndAddress()
Dim computerProperties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Console.WriteLine("Interface information for {0}.{1} ", computerProperties.HostName, computerProperties.DomainName)
Dim adapter As NetworkInterface
For Each adapter In nics
Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
Console.WriteLine(adapter.Description)
Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length, "="c))
Console.WriteLine(" Interface type .......................... : {0}", adapter.NetworkInterfaceType)
Console.WriteLine(" Physical Address ........................ : {0}", adapter.GetPhysicalAddress().ToString())
Console.WriteLine(" Is receive only.......................... : {0}", adapter.IsReceiveOnly)
Console.WriteLine(" Multicast................................ : {0}", adapter.SupportsMulticast)
Next adapter
End Sub
注釈
インターフェイスの種類については、列挙のドキュメントで System.Net.NetworkInformation.NetworkInterfaceType 詳しく説明します。
原則として、このプロパティは列挙体の任意のメンバーを NetworkInterfaceType 返すことができます。 返される特定の値は、基になるネットワーク トポロジのランタイム条件によって異なります。 これは、次のことを意味します。
特定のネットワークに対してプロパティが返す値を事前に特定することはできません。
実際には、特定のネットワークでは、列挙値の全範囲を使用できない可能性があります。 たとえば、ギガビット イーサネット ネットワークでは、 プロパティが ではなく NetworkInterfaceType.GigabitEthernetを返すNetworkInterfaceType.Ethernet可能性があります。