PhysicalAddress コンストラクタ
アセンブリ: System (system.dll 内)
構文
解説
使用例
新しい PhysicalAddress を作成するコード例を次に示します。
public static PhysicalAddress[] StoreNetworkInterfaceAddresses() { IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties(); NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); if (nics == null || nics.Length < 1) { Console.WriteLine(" No network interfaces found."); return null; } PhysicalAddress[] addresses = new PhysicalAddress[nics.Length]; int i = 0; foreach (NetworkInterface adapter in nics) { IPInterfaceProperties properties = adapter.GetIPProperties(); PhysicalAddress address = adapter.GetPhysicalAddress(); byte[] bytes = address.GetAddressBytes(); PhysicalAddress newAddress = new PhysicalAddress(bytes); addresses[i++]=newAddress; } return addresses; }
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- PhysicalAddress コンストラクタのページへのリンク