PhysicalAddress.GetAddressBytes メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > PhysicalAddress.GetAddressBytes メソッドの意味・解説 

PhysicalAddress.GetAddressBytes メソッド

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

現在のインスタンスアドレス返します

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

public byte[] GetAddressBytes ()
public:
array<unsigned char>^ GetAddressBytes ()
public byte[] GetAddressBytes ()
public function GetAddressBytes () : byte[]

戻り値
アドレス格納している Byte 配列

使用例使用例

このメソッド呼び出して PhysicalAddressアドレス取得し、そのアドレス表示用に書式設定するコード例次に示します

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();
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

PhysicalAddress.GetAddressBytes メソッドのお隣キーワード
検索ランキング

   

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



PhysicalAddress.GetAddressBytes メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS