PhysicalAddress クラスとは? わかりやすく解説

PhysicalAddress クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

ネットワーク インターフェイス (アダプタ) のメディア アクセス制御 (MAC: Media Access Control) アドレス提供します

名前空間: System.Net.NetworkInformation
アセンブリ: System (system.dll 内)
構文構文

解説解説
使用例使用例

ローカル コンピュータすべてのインターフェイス物理アドレス表示するコード例次に示します

public static void ShowNetworkInterfaces()
{
    IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
    NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
    Console.WriteLine("Interface information for {0}.{1}
     ",
            computerProperties.HostName, computerProperties.DomainName);
    if (nics == null || nics.Length < 1)
    {
        Console.WriteLine("  No network interfaces found.");
        return;
    }
                     
    Console.WriteLine("  Number of interfaces .................... : {0}",
 nics.Length);
    foreach (NetworkInterface adapter in nics)
    {
        IPInterfaceProperties properties = adapter.GetIPProperties(); //
  .GetIPInterfaceProperties();
        Console.WriteLine();
        Console.WriteLine(adapter.Description);
        Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
        Console.WriteLine("  Interface type .......................... : {0}",
 adapter.NetworkInterfaceType);
        Console.Write("  Physical address ........................ : ");
        PhysicalAddress address = adapter.GetPhysicalAddress();
        byte[] bytes = address.GetAddressBytes();
        for(int i = 0; i< bytes.Length;
 i++)
        {
            // Display the physical address in hexadecimal.
            Console.Write("{0}", bytes[i].ToString("X2"));
            // Insert a hyphen after each byte, unless we are at the
 end of the 
            // address.
            if (i != bytes.Length -1)
            {
                 Console.Write("-");
            }
        }
        Console.WriteLine();
    }
}
継承階層継承階層
System.Object
  System.Net.NetworkInformation.PhysicalAddress
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PhysicalAddress メンバ
System.Net.NetworkInformation 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「PhysicalAddress クラス」の関連用語

PhysicalAddress クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



PhysicalAddress クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS