NetworkInterface.GetPhysicalAddress メソッド
アセンブリ: System (system.dll 内)

Public MustOverride Function GetPhysicalAddress As PhysicalAddress
Dim instance As NetworkInterface Dim returnValue As PhysicalAddress returnValue = instance.GetPhysicalAddress
public abstract PhysicalAddress GetPhysicalAddress ()
public abstract PhysicalAddress GetPhysicalAddress ()
物理アドレスを格納している PhysicalAddress オブジェクト。

このメソッドから返されるオブジェクトには、データ リンク層でデータの転送に使用されるメディアに適したアドレスが格納されます。たとえば、イーサネット ネットワークの場合、このメソッドはイーサネット アドレスを返します。

ローカル コンピュータのすべてのインターフェイスの物理アドレスを表示するコード例を次に示します。
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 'DisplayTypeAndAddress
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); } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からNetworkInterface.GetPhysicalAddress メソッドを検索する場合は、下記のリンクをクリックしてください。

- NetworkInterface.GetPhysicalAddress メソッドのページへのリンク