IPInterfaceProperties.UnicastAddresses プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IPInterfaceProperties.UnicastAddresses プロパティの意味・解説 

IPInterfaceProperties.UnicastAddresses プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

このインターフェイス割り当てられているユニキャスト アドレス取得します

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

Public MustOverride ReadOnly
 Property UnicastAddresses As UnicastIPAddressInformationCollection
Dim instance As IPInterfaceProperties
Dim value As UnicastIPAddressInformationCollection

value = instance.UnicastAddresses
public abstract UnicastIPAddressInformationCollection UnicastAddresses
 { get; }
public:
virtual property UnicastIPAddressInformationCollection^ UnicastAddresses {
    UnicastIPAddressInformationCollection^ get () abstract;
}
/** @property */
public abstract UnicastIPAddressInformationCollection get_UnicastAddresses
 ()
public abstract function get
 UnicastAddresses () : UnicastIPAddressInformationCollection

プロパティ
このインターフェイスユニキャスト アドレス格納している UnicastIPAddressInformationCollection。

解説解説
使用例使用例

ローカル コンピュータ上のネットワーク インターフェイスについて、ユニキャスト アドレス表示するコード例次に示します

Public Shared Sub DisplayUnicastAddresses()
 
    Console.WriteLine("Unicast Addresses")
    Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
    Dim adapter As NetworkInterface
    For Each adapter In
  adapters
        Dim adapterProperties As IPInterfaceProperties
 = adapter.GetIPProperties()
        Dim uniCast As UnicastIPAddressInformationCollection
 = adapterProperties.UnicastAddresses
        If uniCast.Count > 0 Then
            Console.WriteLine(adapter.Description)
            Dim lifeTimeFormat As String
 = "dddd, MMMM dd, yyyy  hh:mm:ss tt"
            Dim uni As UnicastIPAddressInformation
            For Each uni In
  uniCast
                Dim [when] As DateTime
                
                Console.WriteLine("  Unicast Address .........................
 : {0}", uni.Address)
                Console.WriteLine("     Prefix Origin ........................
 : {0}", uni.PrefixOrigin)
                Console.WriteLine("     Suffix Origin ........................
 : {0}", uni.SuffixOrigin)
                Console.WriteLine("     Duplicate Address Detection
 .......... : {0}", uni.DuplicateAddressDetectionState)
                
                ' Format the lifetimes as Sunday, February 16, 2003
 11:33:44 PM
                ' if en-us is the current culture.
                ' Calculate the date and time at the end of the lifetimes.
    
                [when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressValidLifetime)
                [when] = [when].ToLocalTime()
                Console.WriteLine("     Valid Life Time ......................
 : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture))
                [when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressPreferredLifetime)
                [when] = [when].ToLocalTime()
                Console.WriteLine("     Preferred life time ..................
 : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture))
                
                [when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.DhcpLeaseLifetime)
                [when] = [when].ToLocalTime()
                Console.WriteLine("     DHCP Leased Life Time
 ................ : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture))
            Next uni
            Console.WriteLine()
        End If
    Next adapter

End Sub 'DisplayUnicastAddresses

public static void DisplayUnicastAddresses()
{
    Console.WriteLine("Unicast Addresses");
    NetworkInterface[] adapters  = NetworkInterface.GetAllNetworkInterfaces();
    foreach (NetworkInterface adapter in adapters)
    {
        IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
        UnicastIPAddressInformationCollection uniCast = adapterProperties.UnicastAddresses;
        if (uniCast.Count >0)
        {
            Console.WriteLine(adapter.Description);
            string lifeTimeFormat = "dddd, MMMM dd, yyyy
  hh:mm:ss tt";
            foreach (UnicastIPAddressInformation uni in
 uniCast)
            {
                DateTime when;
                
                Console.WriteLine("  Unicast Address .........................
 : {0}", uni.Address);
                Console.WriteLine("     Prefix Origin ........................
 : {0}", uni.PrefixOrigin);
                Console.WriteLine("     Suffix Origin ........................
 : {0}", uni.SuffixOrigin);
                Console.WriteLine("     Duplicate Address Detection ..........
 : {0}", 
                    uni.DuplicateAddressDetectionState);
                    
                // Format the lifetimes as Sunday, February 16, 2003
 11:33:44 PM
                // if en-us is the current culture.
                
                // Calculate the date and time at the end of the lifetimes.
    
                when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressValidLifetime);
                when = when.ToLocalTime();    
                Console.WriteLine("     Valid Life Time ......................
 : {0}", 
                    when.ToString(lifeTimeFormat,System.Globalization.CultureInfo.CurrentCulture)
                );
                when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressPreferredLifetime);
   
                when = when.ToLocalTime();
                Console.WriteLine("     Preferred life time ..................
 : {0}", 
                    when.ToString(lifeTimeFormat,System.Globalization.CultureInfo.CurrentCulture)
                ); 
                
                when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.DhcpLeaseLifetime);
                when = when.ToLocalTime(); 
                Console.WriteLine("     DHCP Leased Life Time ................
 : {0}", 
                    when.ToString(lifeTimeFormat,System.Globalization.CultureInfo.CurrentCulture)
                );
            }
            Console.WriteLine();
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IPInterfaceProperties クラス
IPInterfaceProperties メンバ
System.Net.NetworkInformation 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からIPInterfaceProperties.UnicastAddresses プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からIPInterfaceProperties.UnicastAddresses プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からIPInterfaceProperties.UnicastAddresses プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

IPInterfaceProperties.UnicastAddresses プロパティのお隣キーワード
検索ランキング

   

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



IPInterfaceProperties.UnicastAddresses プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS