PrefixOrigin 列挙体とは? わかりやすく解説

PrefixOrigin 列挙体

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

IP アドレスネットワーク プリフィックス配置され方法示します

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

public enum PrefixOrigin
public enum class PrefixOrigin
public enum PrefixOrigin
public enum PrefixOrigin
メンバメンバ
解説解説
使用例使用例

ユニキャスト アドレスプリフィックスおよびサフィックス情報表示するコード例次に示します

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();
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.Net.NetworkInformation 名前空間


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

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

辞書ショートカット

すべての辞書の索引

「PrefixOrigin 列挙体」の関連用語

PrefixOrigin 列挙体のお隣キーワード
検索ランキング

   

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



PrefixOrigin 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS